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

GridDropDownColumn

4 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eva
Top achievements
Rank 1
Eva asked on 08 Aug 2011, 08:03 PM

How to bind the GridDropDownColumn from code behind. Need help ASAP.

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Aug 2011, 08:23 PM
0
Eva
Top achievements
Rank 1
answered on 09 Aug 2011, 11:21 PM
Could you please provide with a working example. I am having hard time to load the dropdown list value during page load and update the value...
Need help ASAP.

Thanks in advance.
Eva
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Aug 2011, 05:46 AM
Hello,

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)      
{       
     if (e.Item is GridEditableItem && e.Item.IsInEditMode) //fire for both edit and insert       
    {                   
        GridEditableItem eeditItem = e.Item as GridEditableItem;       
        GridEditManager editMgr = editItem.EditManager;       
        GridDropDownListColumnEditor agencyEditor = editMgr.GetColumnEditor("AgencyDDL") as GridDropDownListColumnEditor;       
        string s = DataBinder.Eval(editItem.DataItem, "AgencyID").ToString(); //the field should point to the ListValueField of the dropdown editor     
        DataTable dt = getAgency(); //call data layer function to get an agency datatable    
        agencyEditor.DataSource = dt; 
        agencyDDL.DataSource = dt;    
        agencyDDL.DataBind();     
        agencyDDL.SelectedValue = s;    
        
    }
}

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx
http://www.telerik.com/community/forums/aspnet/grid/griddropdowncolumn-combobox-doesn-t-display-items.aspx#1394032
http://www.telerik.com/community/forums/aspnet-ajax/grid/griddropdowncolumn-bind-from-code-behind.aspx

Let me know if any concern.

Thanks,
Jayesh Goyani
0
Eva
Top achievements
Rank 1
answered on 11 Aug 2011, 12:38 AM

Hi Jayesh,

 

How does the update / insert works. I am binding the grid and ddl from code behind.

 

It will be good, if you have working example with radgrid / GridDropDownList binds from code behind, which will Insert/Update/Edit/Delete/Select from code behind.

 

For a security reason i can't use the sqlsource for this purpose.

 

Need help ASAP.

 

Thanks in advance.

Eva

Tags
Grid
Asked by
Eva
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Eva
Top achievements
Rank 1
Share this question
or