Hi,
I have GridDropDownColumn in RadGrid.In edit mode, i can select items from the GridDropDownColumn but when i click insert button, no items are shown in GridDropDownColumn in RadGrid.Can you help me?
Note : I am not using DataSource, i am using datatable in code to fill grid and dropdown.
I have GridDropDownColumn in RadGrid.In edit mode, i can select items from the GridDropDownColumn but when i click insert button, no items are shown in GridDropDownColumn in RadGrid.Can you help me?
Note : I am not using DataSource, i am using datatable in code to fill grid and dropdown.
4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 22 Aug 2008, 08:29 AM
Hi,
How do you bind your ComboBox? It would be better if you could send the code that you use.
Thanks
Princy.
How do you bind your ComboBox? It would be better if you could send the code that you use.
Thanks
Princy.
0
0
etu
Top achievements
Rank 1
answered on 22 Aug 2008, 08:53 AM
on aspx file , Although i tried datavaluefield,datatextfield,datafield properties in GridDropDownColumn, all the properties didnt work.
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Aug 2008, 10:55 AM
Hello Etu,
Your codes were not viewble. Anyways, you can bind your GridDropDownColumn in Edit/InsertMode as shown in the code below.
cs:
For more information on Customizing a GridDropDownColumn refer to this link.
Princy.
Your codes were not viewble. Anyways, you can bind your GridDropDownColumn in Edit/InsertMode as shown in the code below.
cs:
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
GridEditableItem ititem = (GridEditableItem)e.Item; |
GridEditManager editMan = ititem.EditManager; |
GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("ComboBox")); |
string ConnectionString = "Data Source=INC135; Initial Catalog=MyDataBase;User ID=sa; Password=softinc"; |
SqlConnection conn = new SqlConnection(ConnectionString); |
SqlCommand cmdCustomers = new SqlCommand("SELECT Age FROM Reservation", conn); |
cmdCustomers.CommandType = CommandType.Text; |
conn.Open(); |
SqlDataReader reader = cmdCustomers.ExecuteReader(); |
editor.DataSource = reader; |
editor.DataTextField = "Age"; |
editor.DataBind(); |
conn.Close(); |
} |
} |
For more information on Customizing a GridDropDownColumn refer to this link.
Princy.