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

One TemplateColumn update another via AJAX

3 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DonKitchen
Top achievements
Rank 1
DonKitchen asked on 21 Oct 2008, 04:23 PM
I have a Radgrid with two template columns.  Both columns have radcomboboxes.  I need one of the comboxes to update the values in another, when the row is in edit mode.

How can I access the second combobox when the first one posts back?  I just can't figure how to get to the instance of it.

I'm sure this is something simple that I am just missing.

3 Answers, 1 is accepted

Sort by
0
DonKitchen
Top achievements
Rank 1
answered on 21 Oct 2008, 04:24 PM
Let me add that I already have some code in the SelectedIndexChanged event for the first combobox.  I just need the code for inside there to get at and modify the data in the second combobox.
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Oct 2008, 05:55 AM
Hello,

        Try out the code below to access the second combobox in the SelectedIndexChanged event of the first combobox.
aspx:
<telerik:GridTemplateColumn HeaderText="Countries" UniqueName="TemplateColumn1"
                    <EditItemTemplate> 
                        <telerik:RadComboBox ID="RadComboBox1" AutoPostBack="true" DataSourceID="SqlDataSource1" DataTextField="Countries" DataValueField="Countries"  runat="server" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
                        </telerik:RadComboBox>                     
                    </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn HeaderText="ContID" UniqueName="TemplateColumn2" > 
                    <EditItemTemplate> 
                        <telerik:RadComboBox ID="RadComboBox2" runat="server"
                        </telerik:RadComboBox>                        
                    </EditItemTemplate> 
                  </telerik:GridTemplateColumn>  

cs:
 protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) 
    { 
        RadComboBox combo1 = (RadComboBox)o; 
        GridEditableItem dataItem = (GridEditableItem)combo1.NamingContainer; 
        RadComboBox combo2 = (RadComboBox)dataItem.FindControl("RadComboBox2"); 
        
    } 

Thanks
Princy.
0
DonKitchen
Top achievements
Rank 1
answered on 22 Oct 2008, 04:08 PM
Worked great, thanks!
Tags
Grid
Asked by
DonKitchen
Top achievements
Rank 1
Answers by
DonKitchen
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or