Question

I have a radgrid and within said radgrid, I have a templatecolumn that is a lovely drop down list:

<telerik:GridTemplateColumn HeaderText="Feedback" UniqueName="Feedback">
                            <ItemTemplate>
                                <asp:DropDownList ID="ddlFeedback" runat="server" AppendDataBoundItems="True" AutoPostBack="True" OnSelectedIndexChanged="ddlFeedback_SelectedIndexChanged">  
                               </asp:DropDownList>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

I have a column in my radgrid that is the primary key and it has a lovely value in it.

How can I get the primary key value from the radgrid on the SelectedIndexChanged event of the drop down list i.e. essentially finding the row of the radgrid where the drop down list has been changed?

Was it helpful?

Solution

Found it. Thanks!

DropDownList ddlFeedback = (DropDownList)sender;
            GridDataItem item = (GridDataItem)ddlFeedback.NamingContainer;
            String prikey = item.GetDataKeyValue("PriKey").ToString();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top