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

GridDropDownColumn

1 Answer 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 17 Oct 2008, 10:11 AM
I have a grid with a GridDropDownColumn.  How can I get access to the contents of the dropdown when inserting/updating ?

Ive found an example for textbox but cant find anything for DropDown.  Heres the code im using

protected void RadGridSecondaryCategories_InsertCommand(object source, GridCommandEventArgs e)  
        {  
            //Get the GridEditFormInsertItem of the RadGrid       
            //GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;  
 
            Telerik.Web.UI.GridDataInsertItem insertedItem = (Telerik.Web.UI.GridDataInsertItem)e.Item;  
 
            string EmployeeID = (insertedItem["EmployeeID"].Controls[0] as TextBox).Text;     
             
            string LastName = (insertedItem["LastName"].Controls[0] as TextBox).Text; // need this to be a GriDDropDown  not a textbox 
 How do I get the value in the drop down ?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Oct 2008, 11:58 AM
Hi Mark,

You can try the following code snippet to achieve the desired scenario.

CS:
  protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) 
    { 
        GridDataInsertItem insertitem = (GridDataInsertItem)e.Item; 
        RadComboBox ddl=(RadComboBox)insertitem["DropCol"].Controls[0]; 
        string strSelectedText = ddl.SelectedItem.Text.ToString(); 
    } 



Thanks
Shinu.
Tags
Grid
Asked by
mww
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or