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

GridDropDownColumn DataSource

3 Answers 491 Views
Grid
This is a migrated thread and some comments may be shown as answers.
alsi
Top achievements
Rank 1
alsi asked on 10 Dec 2008, 09:58 AM
Dear All!

I have a RadGrid. In it I have more different dropdown type columns. I want to do to bind them to different datasources in Edit state.
I have custom collections: List<One>,List<Two>,List<Three>

Can I bind them to dropdowns one-by-one in design time? like here:
<
telerik:GridDropDownColumn DataField="OrderID" ListTextField="ShipCountry" ListValueField="OrderID"  DataSourceID="SqlDataSource4" HeaderText="GridDropDownColumn <br /> with RadComboBox" DropDownControlType="RadComboBox" /> - just with my custom Collections.


How can I bind collections to dropdowns?

thanks
alsi

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 11 Dec 2008, 12:22 PM
Hello,

Please review the following forum post which elaborates on this matter. Review the provided example and let us know if this helps.

Greetings,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
alsi
Top achievements
Rank 1
answered on 12 Dec 2008, 09:24 AM
thanks but this is not what I really want.
I want to know if I have two datasource eg.: AccessDataSource and a different List<T>, how can I bind it to the same grid means:
AccessDataSource bind to the grid and almost all Column get data from it, except one which is a DropDown which need to use the List<T> datasource but a grid's column (inside the same grid)

thx
0
Accepted
Princy
Top achievements
Rank 2
answered on 12 Dec 2008, 10:49 AM
Hello Alsi,

You can bind the dropdowncolumn when in EditMode as shown in the code below:
aspx:
<telerik:GridDropDownColumn UniqueName="DropDownColumn" DataField="OrderID" ListTextField="ShipCountry" ListValueField="OrderID" DataSourceID="SqlDataSource4" HeaderText="GridDropDownColumn <br /> with RadComboBox" DropDownControlType="RadComboBox" > 
</telerik:GridDropDownColumn> 
 
          

cs:
 
 private void RadGrid1_ItemDataBound(object  sender, Telerik.Web.UI.GridItemEventArgs e)  
{  
   if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode )  
   {  
        GridEditableItem editedItem = e.Item as GridEditableItem;  
        GridEditManager editMan = editedItem.EditManager;  
  
        GridDropDownListColumnEditor editor = editMan.GetColumnEditor( "DropDownColumn" ) as GridDropDownListColumnEditor;  
               //Then you can modify the list control as per your custom conventions  
        editor.DataSource = List<T>;  
        editor.DataBind();         
   }  
}   
 
 

For more information on customizing dropdowncolumn, you can refer the following help link.
Customize/Configure GridDropDownColumn

Thanks
Princy.
Tags
Grid
Asked by
alsi
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
alsi
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or