New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Attach Event for Editor Changes
There is no default event for editor changes in grid columns - it is up to the developer to attach events to these editors when necessary. This operation can be performed hooking the ItemCreated event of Telerik RadGrid. For example- in case with GridDropDownColumn you have to:
-
Check whether the currently created grid item is GridDataItem and is in edit mode
-
Locate the dropdown list editor in the Controls collection of the cell which corresponds to the GridDropDownList column
-
Mark it with AutoPostBack = true and wire a handler to its SelectedIndexChanged event. Then in the SelectedIndexChanged handler you can update the selected value for the second dropdown.
ASP.NET
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server">
<MasterTableView EditMode="InPlace" AutoGenerateColumns="False">
<Columns>
<telerik:GridBoundColumn HeaderText="CustomerID" DataField="CustomerID" UniqueName="CustomerID">
</telerik:GridBoundColumn>
<telerik:GridDropDownColumn HeaderText="ContactName" ListDataMember="Customers" ListTextField="ContactName"
DataField="CustomerID" UniqueName="DropDownColumn1" ListValueField="CustomerID">
</telerik:GridDropDownColumn>
<telerik:GridDropDownColumn HeaderText="ContactTitle" ListDataMember="Customers"
ListTextField="ContactTitle" DataField="CustomerID" UniqueName="DropDownColumn2"
ListValueField="CustomerID">
</telerik:GridDropDownColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>