Hi ,
I am new to this radgrid . Need some help from anyone who has faced this issue. In the EditFormSetting in the radgrid i have two raddropdownlist. The functionality that i need is ..on selectionindexchange of the first dropdownlist,the contents of second dropdownlist need to be populated from a datasource. How do i achieve this? The problem i am facing is i am not able to access the dropdownlist control in the selectionchanged event of the first dropdownlist.
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table style="width: 500px">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="lblDropdown1:" Visible="true"></asp:Label>
</td>
<td class="tableCellRight" style="width: 85%">
<asp:DropDownList ID="rd_Dropdown1" runat="server" AppendDataBoundItems="True" AutoPostBack="True" Visible="true" OnSelectedIndexChanged="rd_Dropdown1_SelectedIndexChanged" DataSourceID="ds_dropdown1" DataTextField="field2" DataValueField="field1">
<Items>
<asp:ListItem runat="server" Text="--Select item--" Value="NA" />
</Items>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="lbldropdown2:" Visible="False"></asp:Label>
</td>
<td class="tableCellRight" style="width: 85%">
<telerik:RadDropDownList ID="rd_dropdown2" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="ds_dropdown2" DataTextField="field2" DataValueField="field1" Visible="False">
<Items>
<telerik:DropDownListItem runat="server" Text="--Select names--" Value="N/A" />
</Items>
</telerik:RadDropDownList>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
<asp:SqlDataSource ID="ds_dropdown1" runat="server" ConnectionString="<%$ ConnectionStrings:xxConnectionString%>" SelectCommand="SELECT field1, field2 FROM [table1] ">
</asp:SqlDataSource>
<asp:SqlDataSource ID="ds_dropdown2" runat="server" ConnectionString="<%$ ConnectionStrings:xxConnectionString %>" SelectCommand="SELECT [field1], [field2] FROM [table1] WHERE (somecondition)">
</asp:SqlDataSource>
codebehindfile event code
protected void rd_Dropdown1_SelectedIndexChanged(object sender,EventArgs e)
{
//what code is required here to fetch or access dropdown2 control so that i bind it with suitable sqlcommand?
//RadGrid1.DataBind();
}