Hello,
I am using a RadListBox in a custom Web User Control, which has an Item Template. I am dynamically adding items to the list box at runtime by passing the values to a property on the user control. In that property, I create the new item and set its properties as well as the properties on the controls within the item template. Upon callback, the actual items in the list box persist, but the values on the controls in the item template are lost (revert to defaults). The RadListBoxItem.Value is also lost. I also set the value of a custom attribute on the list item. That does survive the callback.
Any assistance would be appreciated.
Code:
I am using a RadListBox in a custom Web User Control, which has an Item Template. I am dynamically adding items to the list box at runtime by passing the values to a property on the user control. In that property, I create the new item and set its properties as well as the properties on the controls within the item template. Upon callback, the actual items in the list box persist, but the values on the controls in the item template are lost (revert to defaults). The RadListBoxItem.Value is also lost. I also set the value of a custom attribute on the list item. That does survive the callback.
Any assistance would be appreciated.
Code:
'Load any pre-existing elements into the list box.
Public
WriteOnly
Property
ConfigElements()
As
clsCommonObjects.ElementItem()
Set
(
ByVal
value()
As
clsCommonObjects.ElementItem)
Dim
intX
As
Int16
Dim
intY
As
Int16
For
intX = 0
To
value.GetUpperBound(0)
Dim
objListItem
As
New
RadListBoxItem
lstAddedElements.Items.Add(objListItem)
objListItem = lstAddedElements.Items(lstAddedElements.Items.Count - 1)
objListItem.Text =
""
objListItem.Value = value(intX).strType
'Use an attribute to store the ID
objListItem.Attributes.Add(
"UniqueID"
, value(intX).strID)
For
intY = 0
To
objListItem.Controls.Count - 1
Select
Case
objListItem.Controls(intY).ID
Case
"lblElementType"
DirectCast
(objListItem.Controls(intY), Label).Text = value(intX).strDisplayType
Case
"lblElementName"
DirectCast
(objListItem.Controls(intY), Label).Text = value(intX).strName
Case
"imgElementType"
DirectCast
(objListItem.Controls(intY), Image).ImageUrl = value(intX).strImageURL
End
Select
Next
objListItem =
Nothing
Next
End
Set
End
Property