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

Could not capture the dropdownlist ID while trying to update a row in gridview

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunil Bojja
Top achievements
Rank 1
Sunil Bojja asked on 24 Jun 2010, 02:53 PM
Hello Friends,

Iam working with Rad Grid. Here when I am trying to update a row I could select the checkbox and then I could get the values in dropdown and textbox. But when I click on update I could not get the id of that dropdown or text box. Please guide me in this issue.
Thanks in advance

Sunil

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Jun 2010, 07:41 AM
Hello Sunil,

I guess you are using 'GridBoundColumn' and 'GridDropDownColumn' and want to access the controls rendered in editform from code behind. If that the case, then you can try the following code snippet.

ASPX:
 <telerik:GridBoundColumn DataField="CategoryID" UniqueName="GridBoundColumn1"
 </telerik:GridBoundColumn> 
 <telerik:GridDropDownColumn DropDownControlType="DropDownList" UniqueName="GridDropDownColumn1"
 </telerik:GridDropDownColumn> 

C#:
  
 protected void RadGrid1_UpdateCommand1(object source, GridCommandEventArgs e) 
    { 
        GridEditFormItem edititem = (GridEditFormItem)e.Item; 
        DropDownList drlist = (DropDownList)edititem["GridDropDownColumn1"].Controls[0];  // access the DropDownList 
        TextBox txt = (TextBox)edititem["GridBoundColumn1"].Controls[0];  //access the TextBox 
     } 

Thanks,
Princy.


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