This is a migrated thread and some comments may be shown as answers.

Cascading dropdowns in edit form

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jayvr
Top achievements
Rank 1
jayvr asked on 19 May 2008, 08:14 PM
Hey support guys,

     I have cascading dropdowns in the Edit template of a RadGrid. When in edit mode, I populate both dropdowns with data correctly. However, when the first dropdown is changed, I want to repopulate the second. I have tried attaching the SelectedIndexChanged event of dropdown1 in the radgrid_itemcreated event and setting autopostback for dropdown1 to true. When I change dropdown1 the page does a post back but it never hits the ddlOUList_SelectedIndexChanged event handler. My grid is in a dynamically created user control in a content page which is in turn in a Master page. Why is the handler not catching? Any ideas?

Thanks,
Jayvr

<telerik:gridtemplatecolumn headerstyle-horizontalalign="Center" headertext="Operating Units" uniquename="colOperatingUnit">

<itemtemplate>

<asp:label id="lblOpUnit" runat="server" />

</itemtemplate>

<edititemtemplate>

<asp:dropdownlist cssclass="inputControlsNoWidth" id="ddlEditOUs" autopostback="true" runat="server" />

</edititemtemplate>

</telerik:gridtemplatecolumn>

<telerik:gridtemplatecolumn headerstyle-horizontalalign="Center" headertext="Responsibility" uniquename="colResponsibility">

<itemstyle width="30%" horizontalalign="Left" />

<itemtemplate>

<asp:label id="lblResp" runat="server" />

</itemtemplate>

<edititemtemplate>

<asp:dropdownlist cssclass="inputControlsNoWidth" id="ddlEditResp" runat="server" />

</edititemtemplate>

</telerik:gridtemplatecolumn>


void rgOUList_ItemCreated(object sender, GridItemEventArgs e)

{

if((e.Item is GridEditableItem) && (e.Item.IsInEditMode))

{

DropDownList ddlOUList = (e.Item as GridEditableItem).FindControl("ddlEditOUs") as DropDownList;

if(ddlOUList != null)

{

ddlOUList.SelectedIndexChanged +=

new EventHandler(this.ddlOUList_SelectedIndexChanged);

}

}

}

1 Answer, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 20 May 2008, 04:12 PM
Hi jayvr,

You can find a similar demo here:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/AccessingCellsAndRows/DefaultCS.aspx

Changing the drop down value in Grid edit mode even performs an AJAX request updating the quantity drop down, so you can definitely use it as reference to see what is missing in your code.

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
jayvr
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Share this question
or