G
Guest
Hello All,
I am populating an HtmlSelect control's Items property with four list items.
The HtmlSelect control is contained in a user control which is dropped into
a placeholder on the web form. When the page is rendered, the control is
empty. Here is the code:
In the web form:
Dim UControl As AugmentedDropDownList =
CType(LoadControl("../UserControls/AugmentedDropDownList.ascx"),
AugmentedDropDownList)
UControl.PopulateDropDownList(Control.Attributes("name").Value, DropDownNode)
plcContent.Controls.Add(UControl)
and in the user control:
Public Sub PopulateDropDownList(ByVal ListCaption As String, ByVal
ListItems As XmlNode)
Label1.Text = ListCaption
SelectList = New HtmlSelect
SelectList.Name = ListCaption
For Each Item As XmlNode In ListItems.SelectNodes("Items/Item")
Dim li As New ListItem
li.Value = Item.Attributes("id").Value
li.Text = Item.Attributes("value").Value
SelectList.Items.Add(li)
Next
SelectList.ID = ListItems.Attributes("id").Value
End Sub
Can anyone see what I'm missing?
TIA,
I am populating an HtmlSelect control's Items property with four list items.
The HtmlSelect control is contained in a user control which is dropped into
a placeholder on the web form. When the page is rendered, the control is
empty. Here is the code:
In the web form:
Dim UControl As AugmentedDropDownList =
CType(LoadControl("../UserControls/AugmentedDropDownList.ascx"),
AugmentedDropDownList)
UControl.PopulateDropDownList(Control.Attributes("name").Value, DropDownNode)
plcContent.Controls.Add(UControl)
and in the user control:
Public Sub PopulateDropDownList(ByVal ListCaption As String, ByVal
ListItems As XmlNode)
Label1.Text = ListCaption
SelectList = New HtmlSelect
SelectList.Name = ListCaption
For Each Item As XmlNode In ListItems.SelectNodes("Items/Item")
Dim li As New ListItem
li.Value = Item.Attributes("id").Value
li.Text = Item.Attributes("value").Value
SelectList.Items.Add(li)
Next
SelectList.ID = ListItems.Attributes("id").Value
End Sub
Can anyone see what I'm missing?
TIA,