GridDropDownColumn

2 posts, 0 answers
  1. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 17 Oct 2008 Link to this post

    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 ?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Oct 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top