RadComboBox in Gridtemplatecolumn

2 posts, 0 answers
  1. Joel
    Joel avatar
    176 posts
    Member since:
    Oct 2006

    Posted 17 Nov 2016 Link to this post

    I have the following:

     

    <telerik:GridTemplateColumn DataField="password" >
                 <ItemTemplate>
                                             
                         <telerik:RadComboBox runat="server" ID="ddlActions" Skin="Silk" Width="115" AutoPostBack="true" OnSelectedIndexChanged="ddlActions_SelectedIndexChanged">
                       <Items>
                        <telerik:RadComboBoxItem Value="-1" Text="Select Action" />
                        <telerik:RadComboBoxItem Value="0" Text="Edit" />
                        <telerik:RadComboBoxItem Value="1" Text="Opt-out" />
                        <telerik:RadComboBoxItem Value="2" Text="Save" />
                         <telerik:RadComboBoxItem Value="3" Text="View" />
                         </Items>
                     </telerik:RadComboBox>
             </ItemTemplate>
    </telerik:GridTemplateColumn>

     

     

    protected void ddlActions_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
            {
                RadComboBox rcb = (RadComboBox)sender;
                GridDataItem data = (GridDataItem)rcb.NamingContainer;
     
                string pwd = data.GetDataKeyValue("pwd").ToString();
                string rid = data.GetDataKeyValue("rid").ToString();
                 
                switch(rcb.SelectedValue)
                {
                    case "0":
    .....

     

     

    The switch works perfectly the first time any radcombobox in the grid is changed.  The problem I am having is that when a subsequent radcombobox is changed in a different row, the sender appears to be the first radcombobox which was changed, not the actual (second) changed radcombobox.

     

    How do I work around this?

     

     

     

     

     

     

     

     

     

  2. Patrick
    Admin
    Patrick avatar
    207 posts

    Posted 18 Nov 2016 Link to this post

    Hello Joel,

    I was unable to replicate the issue, but I have attached a working project using the approach you've described.  

    If your application continues to not work, please include more details including code.

    I hope clear things!

    Regards,
    Patrick
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top