I have a RadGrid for a news management system. In EditFormSettings – FormTemplate I need a Treeview inside the FormTemplate which depends on the ArticleID of the news in edit mode. Data for Treeview comes from a stored procedure which expects ArticleID as parameter.
I expected that<telerik:RadTreeView ID="RadTreeView1" runat="server" DataFieldID="PortalID" |
DataNavigateUrlField="PortalID" DataSourceID="SqlPortalTreeDataSource" |
DataTextField="PortalName" DataValueField="PortalID"> |
</telerik:RadTreeView> |
<asp:SqlDataSource ID="SqlPortalTreeDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" |
SelectCommand="peRedPlan_GetPortalsTree" SelectCommandType="StoredProcedure"> |
<SelectParameters> |
<asp:ControlParameter ControlID="RadGrid1" Name="ArticleID" PropertyName="SelectedValue" Type="Int32" /> |
</SelectParameters> |
</asp:SqlDataSource> |
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 02 Apr 2009, 06:24 AM
Hi Heinz,,
Would you please try the below ControlParameter declaration and let me know whether it works.
<asp:ControlParameter ControlID="RadGrid1" Name="ArticleID" DefaultValue="7272" |
PropertyName="SelectedValues['ArticleID']" Type="Int32" /> |
-Shinu.
0
Heinz
Top achievements
Rank 1
answered on 02 Apr 2009, 06:35 AM
No, does not work. Profiler shows me, that the sp is still called with the default value and with not the current ArticleID.
0
Heinz
Top achievements
Rank 1
answered on 02 Apr 2009, 08:09 AM
Hi,
seems not to be a issue from Treeview but from RadGrid. I tried RadCombobox or simple ASP dropdownlist instead of Treeview. All the same, RadGrid does not provide the ArticleID as ControlParameter. But it shows me ArticleID in Editmode as Literal. e.g. as
Any idea?
seems not to be a issue from Treeview but from RadGrid. I tried RadCombobox or simple ASP dropdownlist instead of Treeview. All the same, RadGrid does not provide the ArticleID as ControlParameter. But it shows me ArticleID in Editmode as Literal. e.g. as
<%#Eval("ArticleID")%> |
0
Shinu
Top achievements
Rank 2
answered on 03 Apr 2009, 04:21 AM
Hi Heinz,
I have used the radgrid in one of my application just like the related grid where I'm passing the Id from first grid to populate the second, so i think that it is not the problem with the Radgrid.
Would you please check whether your radgrid is placed inside any control so that while rendering to html it's clientId will be different from RadGrid1
for example if the grid is inside rock itz clientid will be like this "RadDock1$C$RadGrid1"
so you have to use the ControlParameter statement as shown below.
Here is the online demo of related grid showing how to pass the selected Id from the Radgrid as controlPaermeter.
-Shinu
I have used the radgrid in one of my application just like the related grid where I'm passing the Id from first grid to populate the second, so i think that it is not the problem with the Radgrid.
Would you please check whether your radgrid is placed inside any control so that while rendering to html it's clientId will be different from RadGrid1
for example if the grid is inside rock itz clientid will be like this "RadDock1$C$RadGrid1"
so you have to use the ControlParameter statement as shown below.
<asp:ControlParameter ControlID="RadDock1$C$RadGrid1" Name="ArticleID" DefaultValue="7272" |
PropertyName="SelectedValues['ArticleID']" Type="Int32" /> |
Here is the online demo of related grid showing how to pass the selected Id from the Radgrid as controlPaermeter.
-Shinu
0
Heinz
Top achievements
Rank 1
answered on 03 Apr 2009, 06:40 AM
Thanks Shinu,
but I got some code behind via support ticket yesterday which runs fine. I will check your solution next days.
Thanks to you and the Telerik team.
Heinz
but I got some code behind via support ticket yesterday which runs fine. I will check your solution next days.
Thanks to you and the Telerik team.
Heinz
public partial class _Default : System.Web.UI.Page |
{ |
int categoryID; |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e) |
{ |
e.Command.Parameters[0].Value = categoryID; |
} |
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
categoryID = Convert.ToInt32(((GridEditableItem)e.Item).GetDataKeyValue("CategoryID")); |
} |
} |
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
} |
} |
0
Robert
Top achievements
Rank 1
answered on 25 Nov 2009, 08:24 PM
I have this same problem everytime I use Custom edit templates. Here is my SQL statement which feeds my treeview however I cannot get the parameter value from radgrid1.
have have tried both suggestions in this post with no success. Does anyone have a way to get this parameter value?
SQL for RADGRID1...... |
<asp:SqlDataSource ID="SqlDataSource1" runat="server" |
ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>" |
SelectCommand="SELECT Dictationid, Dictatorid, Jobstate, AssignedTranID, PriorityLevel, Worktype, Datedictated, DateUploaded, [Document] FROM Dictations"> |
</asp:SqlDataSource> |
SQL for Treeview..... |
<asp:SqlDataSource ID="SqlDataSource5" runat="server" |
ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>" |
SelectCommand="SELECT BillingID, Dictationid, Code, Parentid, Text FROM Dictation_Billingcodes WHERE (Dictationid = @Dictationid)"> |
<SelectParameters> |
<asp:ControlParameter ControlID="RadGrid1" Name="Dictationid" |
PropertyName="SelectedValue" DefaultValue="1" /> |
</SelectParameters> |