I followed the example in "RadComboBox in RadGrid", the ItemsRequested event is not firing. attached the code. Please help me, is there any mistake in the code.
Thanks,
Muthu
Thanks,
<
telerik:RadGrid
ID
=
"RadGrid2"
GridLines
=
"None"
AutoGenerateColumns
=
"false"
PageSize
=
"7"
AllowPaging
=
"true"
AllowSorting
=
"true"
runat
=
"server"
OnItemDataBound
=
"OnItemDataBoundHandler"
DataSourceID
=
"ProductsDataSource"
AllowAutomaticUpdates
=
"true"
AllowAutomaticInserts
=
"True"
ShowStatusBar
=
"true"
Skin
=
"Office2010Blue"
>
<
MasterTableView
ShowFooter
=
"false"
DataKeyNames
=
"inventoryid"
EditMode
=
"InPlace"
CommandItemDisplay
=
"TopAndBottom"
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"conditioncode"
HeaderText="<%$ Resources:locStrings, GV_COL_PO_ConditionCode %>" SortExpression="conditioncode" ItemStyle-Width="150px">
<
FooterTemplate
> Template footer</
FooterTemplate
>
<
FooterStyle
VerticalAlign
=
"Middle"
HorizontalAlign
=
"Center"
/>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "conditioncode")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"RadComboBox1"
EnableLoadOnDemand
=
"True"
DataTextField
=
"code"
DataValueField
=
"conditionid"
AutoPostBack
=
"true"
HighlightTemplatedItems
=
"true"
Height
=
"140px"
Width
=
"150px"
DropDownWidth
=
"200px"
OnItemsRequested
=
"RadComboBox1_ItemsRequested"
OnSelectedIndexChanged
=
"OnSelectedIndexChangedHandler"
>
<
HeaderTemplate
>
<
ul
>
<
li
class
=
"col1"
>Code</
li
>
<
li
class
=
"col2"
>Condition</
li
>
</
ul
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
ul
>
<
li
class
=
"col1"
>
<%# DataBinder.Eval(Container,"Text")%>
</
li
>
<
li
class
=
"col2"
>
<%# DataBinder.Eval(Container,"Attributes['code']")%></
li
>
</
ul
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridEditCommandColumn
FooterText
=
"EditCommand footer"
UniqueName
=
"EditCommandColumn"
HeaderText
=
"Edit"
UpdateText
=
"Update"
HeaderStyle-Width
=
"100px"
>
</
telerik:GridEditCommandColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"ProductsDataSource"
runat
=
"server"
ConnectionString
=
"Data Source=VSSCLOUDAPP1;Initial Catalog=iqrtest_20113108;User ID=sa; Password=admin!23"
SelectCommand="SELECT ptid, inventoryid, unitcost, conditioncode, status, receivestatus, mfgr
FROM inventory WHERE
ptid
=
501
">
</
asp:SqlDataSource
>
C#:
protected void OnItemDataBoundHandler(object sender, GridItemEventArgs e)
{
if (e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
if (!(e.Item is IGridInsertItem))
{
RadComboBox combo = (RadComboBox)item.FindControl("RadComboBox1");
RadComboBoxItem selectedItem = new RadComboBoxItem();
selectedItem.Value = ((DataRowView)e.Item.DataItem)["conditionid"].ToString();
selectedItem.Text = ((DataRowView)e.Item.DataItem)["code"].ToString();
selectedItem.Attributes.Add("condition", ((DataRowView)e.Item.DataItem)["condition"].ToString());
combo.Items.Add(selectedItem);
selectedItem.DataBind();
Session["conditionid"] = selectedItem.Value;
}
}
}
protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
DataTable dt = new DataTable();
dt = IQR.Generic.cGeneric.GetData(cStoredProcedureConstants.SP_POItem_GetConditionCodes, true);
RadComboBox rcbConditionCode = (RadComboBox)sender; // Clear the default Item that has been re-created from ViewState at this point. comboBox.Items.Clear();
foreach (DataRow row in dt.Rows)
{
RadComboBoxItem item = new RadComboBoxItem();
item.Value = row["conditionid"].ToString();
item.Text = row["code"].ToString();
item.Attributes.Add("condition", row["condition"].ToString());
rcbConditionCode.Items.Add(item);
item.DataBind();
}
}
protected void OnSelectedIndexChangedHandler(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
Session["conditionid"] = e.Value;
}
Muthu