Hi,
I have my grid setup like this:
Now I have some questions relating to this:
1. Do I need to manually handle the populating of the field for 'view' mode? Unless I use the code below in ItemDataBound then in view mode the dropdown column is empty.
2. Why does the drop down column have no controls, in ItemDataBound:
3. Is it possible to use a non-datasource-bound combo? so in ItemDataBound I would do something like this:
I have my grid setup like this:
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"col1"
HeaderText
=
"Col 1"
UniqueName
=
"mytxt"
/>
<
telerik:GridDropDownColumn
DataField
=
"col2"
UniqueName
=
"mydd"
DropDownControlType
=
"RadComboBox"
HeaderText
=
"Col 2"
/>
</
Columns
>
Now I have some questions relating to this:
1. Do I need to manually handle the populating of the field for 'view' mode? Unless I use the code below in ItemDataBound then in view mode the dropdown column is empty.
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DataRowView row = (DataRowView)e.Item.DataItem;
item[
"mydd"
].Text = row[
"col2"
].ToString();
}
2. Why does the drop down column have no controls, in ItemDataBound:
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
//Controls has one control:
//RadTextBox = (RadTextBox)item["mytxt"].Controls[0];
//Controls is empty:
//RadComboBox com = (RadComboBox)item["mydd"].Controls[0];
}
3. Is it possible to use a non-datasource-bound combo? so in ItemDataBound I would do something like this:
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
RadComboBox com = (RadComboBox)item[
"mydd"
].Controls[0];
com.Items.Add(
new
RadComboxItem(
"a"
,
"a"
));
com.Items.Add(
new
RadComboxItem(
"b"
,
"b"
));
}