Help please,
I am using a rad combo that I am populating with a SQL data source, I have set an item template for the display which displays the correct information but when I select the item it shows the id and not the selected name, I'm not sure what I am doing wrong.
the code I'm using is as follows
on the aspx page
and the code behind is attached to the OnItemDataBound Event
I end up with the list been populated with the username but when an item is selected it shows a number instead of the selected name and not sure on where I am going wrong.
I am using a rad combo that I am populating with a SQL data source, I have set an item template for the display which displays the correct information but when I select the item it shows the id and not the selected name, I'm not sure what I am doing wrong.
the code I'm using is as follows
on the aspx page
<
telerik:RadComboBox
ID
=
"DDL_Treatedby"
runat
=
"server"
OnItemDataBound
=
"DDL_Treatedby_ItemDataBound"
"
DropDownAutoWidth
=
"Enabled"
EmptyMessage
=
"Treated By"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"LAB_TreatedName"
runat
=
"server"
></
asp:Label
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
and the code behind is attached to the OnItemDataBound Event
protected
void
DDL_Treatedby_ItemDataBound(
object
sender, RadComboBoxItemEventArgs e)
{
UserPermissions tempper = (UserPermissions)e.Item.DataItem;
Label templabel = (Label)e.Item.FindControl(
"LAB_TreatedName"
);
if
(tempper !=
null
&& templabel !=
null
)
{
users temp = users.GetUserBYID(tempper.UserID);
templabel.Text = temp.Forename +
" "
+ temp.Surname;
}
}
I end up with the list been populated with the username but when an item is selected it shows a number instead of the selected name and not sure on where I am going wrong.