Zlatko Rusev
Top achievements
Rank 1
Zlatko Rusev
asked on 03 Nov 2009, 09:28 AM
Hi,
I wonder how I can user string [] like a datasource for RadGridDropDownColumn !
Thanks for you answer
I wonder how I can user string [] like a datasource for RadGridDropDownColumn !
Thanks for you answer
5 Answers, 1 is accepted
0
Accepted
Shinu
Top achievements
Rank 2
answered on 03 Nov 2009, 10:03 AM
Hello Zlatko,
You can try out the following code to set the datasource of the dropdownlist when the GridDropDownColumn is in edit mode:
c#:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
| { |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| GridEditManager editMan = editedItem.EditManager; |
| GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("DropDownColumn")); |
| editor.DataSource = new string[] { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6" }; |
| editor.DataBind(); |
| } |
| } |
Thanks
Shinu.
0
Zlatko Rusev
Top achievements
Rank 1
answered on 03 Nov 2009, 10:08 AM
Thank you
0
Zlatko Rusev
Top achievements
Rank 1
answered on 04 Nov 2009, 12:59 PM
Excuse me,
When I use only this, it doesn't bind field value from database and selected field is not correct.
My database field is string. How I can do this in html code
I use
<telerik:GridDropDownColumn DataField="ClosingTag" UniqueName="ClosingTag" HeaderText="sometext"
DropDownControlType="RadComboBox">
</telerik:GridDropDownColumn>
Thank you for answer
Z.Rusev
When I use only this, it doesn't bind field value from database and selected field is not correct.
My database field is string. How I can do this in html code
I use
<telerik:GridDropDownColumn DataField="ClosingTag" UniqueName="ClosingTag" HeaderText="sometext"
DropDownControlType="RadComboBox">
</telerik:GridDropDownColumn>
Thank you for answer
Z.Rusev
0
Princy
Top achievements
Rank 2
answered on 04 Nov 2009, 01:48 PM
Hello,
A suggestion would be to use a GridTemplateColumn with a label in its ItemTemplate and a RadComboBox in its EditItemTemplate. You can bind the Label to the corresponding field in the database and when the grid is in edit mode, bind the combobox to the string[].
aspx:
Thanks
Princy.
A suggestion would be to use a GridTemplateColumn with a label in its ItemTemplate and a RadComboBox in its EditItemTemplate. You can bind the Label to the corresponding field in the database and when the grid is in edit mode, bind the combobox to the string[].
aspx:
| <telerik:GridTemplateColumn UniqueName="TemplateColumn1"> |
| <ItemTemplate> |
| <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="RadComboBox1" runat="server"> |
| </telerik:RadComboBox> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
Thanks
Princy.
0
Zlatko Rusev
Top achievements
Rank 1
answered on 04 Nov 2009, 03:16 PM
Very excuse, but I can't find way to bind when RadComboBox is in EditItem Template. Can you help me ?
I've try this
((RadComboBox)editedItem.FindControl("ClosingTag")).DataSource = new string[] { "", "And", "O", ")" };
((RadComboBox)editedItem.FindControl("ClosingTag")).DataBind();
but is doesn't work
Thank
Z. Rusev
I've try this
((RadComboBox)editedItem.FindControl("ClosingTag")).DataSource = new string[] { "", "And", "O", ")" };
((RadComboBox)editedItem.FindControl("ClosingTag")).DataBind();
but is doesn't work
Thank
Z. Rusev