Hi,
I am implementing a multicolumn radcombo and I need to access indiviual column values. I saw from the demo that this can be acheived by setting attributes. and this I am trying to do in ItemDataBound event. But in ItemDatabound event e.Item.DataItem is null, Please have a look at the below code and let me know what could be the issue. The data is getting beinded to the drodown, but datatitem is null
ASPX CODe
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
Width
=
"150px"
HighlightTemplatedItems
=
"true"
CssClass
=
"cmb_borderstyle"
OnClientSelectedIndexChanged
=
"onClientSelectedIndexChanged"
DropDownWidth
=
"200px"
EnableEmbeddedSkins
=
"false"
Skin
=
"NextGen"
CausesValidation
=
"false"
OnItemDataBound
=
"RadComboBox1_ItemDataBound"
>
<
CollapseAnimation
Type
=
"OutQuint"
Duration
=
"200"
></
CollapseAnimation
>
<
ItemTemplate
>
<
div
class
=
"cmb_ltFlt"
style
=
"width:100%"
>
<
div
class
=
"cmb_rdFnt cmb_ltFlt"
>
<%# DataBinder.Eval(Container.DataItem, "paymentTypeDesc") %>Item1</
div
>
<
div
class
=
"cmb_rdFnt cmb_ltFlt cmb_sp20"
>
<%# DataBinder.Eval(Container.DataItem, "delvOptionDesc")%>Row1 Col2</
div
>
<
div
class
=
"cmb_rdFnt cmb_ltFlt cmb_sp20"
>
<%# DataBinder.Eval(Container.DataItem, "serviceFQN") %>Row1 Col3</
div
>
</
div
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
C# Code
public
class
PaymentSelectionData
{
public
string
paymentTypeDesc {
get
;
set
; }
public
string
delvOptionDesc {
get
;
set
; }
public
string
serviceFQN {
get
;
set
; }
public
string
refVal {
get
;
set
; }
}
//Below logic is implemented in some method and called form PageLoad
List<PaymentSelectionData> lstPmtSel =
new
List<PaymentSelectionData>();
for
(
int
i = 1; i <= 5; i++)
{
pmtSelData =
new
PaymentSelectionData();
pmtSelData.paymentTypeDesc =
"PaymentTypeDesc"
+ i.ToString();
pmtSelData.delvOptionDesc =
"DelvOption"
+ i.ToString();
pmtSelData.serviceFQN =
"ServiceFQN"
+ i.ToString();
pmtSelData.refVal = pmtSelData.paymentTypeDesc +
"#"
+ pmtSelData.delvOptionDesc +
"#"
+ pmtSelData.serviceFQN;
lstPmtSel.Add(pmtSelData);
}
RadComboBox1.DataValueField = pmtSelData.refVal;
RadComboBox1.DataTextField =
"paymentTypeDesc"
;
RadComboBox1.DataSource = lstPmtSel;
RadComboBox1.DataBind();
protected
void
RadComboBox1_ItemDataBound(
object
sender, RadComboBoxItemEventArgs e)
{
//row is null
System.Data.DataRowView row = e.Item.DataItem
as
System.Data.DataRowView;
}
public
class PaymentSelectionData
{
public string paymentTypeDesc { get; set; }
public string delvOptionDesc { get; set; }
public string serviceFQN { get; set; }
public string refVal { get; set; }
}