or
<
asp:DropDownList
ID
=
"AddressDropDownList"
runat
=
"server"
DataSourceID
=
"AddressSqlDataSource"
DataTextField
=
"adrFullname"
DataValueField
=
"adrIdx"
AppendDataBoundItems
=
"True"
AutoPostBack
=
"True"
>
<
asp:ListItem
Value
=
""
Text
=
"--All--"
></
asp:ListItem
>
</
asp:DropDownList
>
<
telerik:RadComboBox
ID
=
"xrcarCarIdxRadComboBox"
runat
=
"server"
DataSourceID
=
"CarrierListSQLDataSource"
DataTextField
=
"carName"
DataValueField
=
"carIdx"
SelectedValue='<%# Bind("xrcarCarIdx") %>' Width="300" HighlightTemplatedItems="true">
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"CarrierListLabel"
>
<
b
><%# Eval("carName") %></
b
><
br
/><%# Eval("carAddress")%><
br
/><%# Eval("carCSZ")%>
</
asp:Label
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
<
telerik:RadFormDecorator
ID
=
"FormDecorator1"
runat
=
"server"
DecoratedControls
=
"all"
>
</
telerik:RadFormDecorator
>
RadGrid1.MasterTableView.FilterExpression =
"ParentID is null "
The code is modeled after the sample here
I can get it to work without the FilterExpression, but all items show up under the main grid, and then again as children. It seems very simple, but I must be missing something.
<
telerik:GridBoundColumn
DataField
=
"CommunicationModule"
HeaderText
=
"CommunicationModule"
UniqueName
=
"CommunicationModule"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Module"
HeaderText
=
"Module"
UniqueName
=
"Module"
ItemStyle-Width
=
"400px"
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "Module")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"cboModule"
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
protected
void
RadGridCU_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item.IsInEditMode)
{
if
(!(e.Item
is
IGridInsertItem))
//Is this a new item?
{
GridEditFormItem item = (GridEditFormItem)e.Item;
RadComboBox cmb = (RadComboBox)item.FindControl(
"cboModule"
);
cmb.DataSource =
//Here I have logic to set the datasource (works);
cmb.DataTextField =
"Name"
;
cmb.DataValueField =
"OID"
;
//I tried to use
//item["CommunicationModule"].Text.ToString();
//But to get it to work, I needed to create helper class and then cast the dataitem..
cmb.SelectedValue = ((MyGridHelperClass)e.Item.DataItem).CommunicationModule.ToString();
cmb.DataBind();
}
}
}
TRANSACTION_CURRENCY_CD
should be a DropDown
list.....
<
Columns
>
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"ACCOUNT_ID"
UniqueName
=
"ACCOUNT_ID"
HeaderText
=
"Account ID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDropDownColumn
UniqueName
=
"TRANSACTION_CURRENCY_CD
"
ListTextField
=
"TRANSACTION_CURRENCY_CD"
ListValueField
=
"TRANSACTION_CURRENCY_CD"
HeaderText
=
"DropDown Column"
DataField
=
"TRANSACTION_CURRENCY_CD"
DropDownControlType
=
"RadComboBox"
AllowSorting
=
"true"
>
</
telerik:GridDropDownColumn
>
<
telerik:GridBoundColumn
DataField
=
"TRANSACTION_AMT"
UniqueName
=
"TRANSACTION_AMT"
HeaderText
=
"TRANSACTION_AMT"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"LOCAL_CURRENCY_CD"
UniqueName
=
"LOCAL_CURRENCY_CD"
HeaderText
=
"LOCAL_CURRENCY_CD"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"LOCAL_AMT"
UniqueName
=
"LOCAL_AMT"
HeaderText
=
"LOCAL_AMT"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SUB1"
UniqueName
=
"SUB1"
HeaderText
=
"SUB1"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SUB2"
UniqueName
=
"SUB2"
HeaderText
=
"SUB2"
>
</
telerik:GridBoundColumn
>
</
Columns
>
.....
public
DataTable CustomersTable
{
get
{
DataTable res = (DataTable)
this
.Session[
"CustomersTable"
];
if
(res ==
null
)
{
res = (DataTable)Table0021.Lade(
"1"
).Tables[0];
this
.Session[
"CustomersTable"
] = res;
}
return
res;
}
}
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = this.CustomersTable;
}
TRANSACTION_CURRENCY_CD
is the column name in the DatatableTRANSACTION_CURRENCY_CD
is always Empty (in the edit mode, too)et a List<String> with the Elemts for the DropDownList. How can I bind this to the dropdownlist
Thank you very much!