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

RadComboBox in Gridtemplatecolumn

1 Answer 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 17 Nov 2016, 08:48 PM

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?

 

 

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 18 Nov 2016, 09:04 PM
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.
Tags
Grid
Asked by
Joel
Top achievements
Rank 2
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or