Hi,
I wonder how to bind a ComboBox in the new Control DataForm.
I have created a script as follows.
aspx
aspx.cs
however, if(comboBox!=null) <---- here is always null.
Please tell me the right way.
thx
I wonder how to bind a ComboBox in the new Control DataForm.
I have created a script as follows.
aspx
....
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel2"
runat
=
"server"
Height
=
"100%"
Width
=
"100%"
HorizontalAlign
=
"NotSet"
LoadingPanelID
=
"baseLoadingPanel"
OnAjaxRequest
=
"RadAjaxPanel2_AjaxRequest"
>
<
telerik:RadDataForm
ID
=
"detailsView"
runat
=
"server"
OnPreRender
=
"detailsView_PreRender"
>
<
ItemTemplate
>
<
table
class
=
"InputTable"
border
=
"1"
>
<
tr
>
<
td
>
<
telerik:RadComboBox
ID
=
"comboBoxItem"
runat
=
"server"
SelectedValue='<%# Eval("item") %>' Width="100%" ValueType="System.String">
</
telerik:RadComboBox
>
</
td
>
</
tr
>
...
aspx.cs
protected
void
detailsView_PreRender(
object
sender, EventArgs e)
{
RadComboBox comboBox = (RadComboBox)detailsView.FindControl(
"comboBoxItem"
);
if
(comboBox!=
null
)
{
DataTable dataTable =
new
DataTable();
dataTable = SelectCommonCode(codeKind, whereclause);
comboBox.DataSource = dataTable;
comboBox.DataTextField =
"codename"
;
comboBox.DataValueField =
"code"
;
comboBox.DataBind();
}
}
however, if(comboBox!=null) <---- here is always null.
Please tell me the right way.
thx