Hi,
I need some help with this issue, I am trying to bind a Radcombobox with an itemtemplate in Codebehind. I am binding it in codebehind in the Grids ItemDataBound event because I need to pass in the producttypeID from the grid to the Editform RadCombobox and then I can display the different products for that product Type in the combo box, but I am getting errors like 'attribute is set to null or not an object' ? Can someone please point out what to do so I can pass in the ObjectdataSource select parameters and display this correctly? your helps appreciated!
Here is the code
ASPX:
<
telerik:RadComboBox
ID
=
"cboxProductsShipped"
runat
=
"server"
HighlightTemplatedItems
=
"true"
EnableLoadOnDemand
=
"true"
Height
=
"190px"
Width
=
"350px"
>
<
ItemTemplate
>
<
li
class
=
"col1"
>
<%# DataBinder.Eval(Container.DataItem, "ProductName")%>
</
li
>
<
li
class
=
"col2"
>
<%# DataBinder.Eval(Container.DataItem, "Size")%>
</
li
>
<
li
class
=
"col3"
>
<%# DataBinder.Eval(Container.DataItem, "Quantity")%>
</
li
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
<
asp:ObjectDataSource
ID
=
"ODSProducts"
runat
=
"server"
TypeName
=
"ProductBL"
DataObjectTypeName
=
"DAL.Products"
SelectMethod
=
"GetProductsByProductType"
>
</
asp:ObjectDataSource
>
C#
protected void ProductsGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
try
{
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
RadComboBox cboxProducts = (RadComboBox)editItem.FindControl("cboxProductsShipped");
ODSProducts.SelectParameters.Add("producttype_id", ((Product)e.Item.DataItem).productType_id.ToString());
cboxProducts.DataSourceID = "ODSProducts";
cboxProducts.DataBind();
}
}
catch (Exception ex)
{
throw;
}
}