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

How to find Combo Box id?

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Guruvu
Top achievements
Rank 1
Guruvu asked on 26 Nov 2010, 11:31 AM
Hi,

I have 2 combo boxes in Grid Edit Itemitem template.When i editing record in Grid i am getting data to both the combo boxes very fine.My requirement is,if i select first combobox then i need to clear the second combobox items & bind some data based on first Combobox selected value.

Here how can i get first combobox ID in first combobox SelectedIndexChanged Event.

Please suggest me...


Thanks.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Nov 2010, 11:42 AM
Hello Guruvu,

In order to achieve this, first access the EditFormItem using NamingContainer property of RadComboBox(second). Then using FindControl method access the first ComboBox. Sample code is given below.

C#:
protected void RadComboBox2_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        RadComboBox combobox2 = (RadComboBox)o;
        GridEditFormItem editItem = (GridEditFormItem)combobox2.NamingContainer;
        RadComboBox combobox1 = (RadComboBox)editItem.FindControl("RadComboBox1"); // accessing first ComboBox in EditItemTemplate
    }

Thanks,
Princy.
0
Guruvu
Top achievements
Rank 1
answered on 26 Nov 2010, 12:21 PM
Hi Princy,

My probles was solved.Thank you very much for your quick response.

Tags
Grid
Asked by
Guruvu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Guruvu
Top achievements
Rank 1
Share this question
or