K
Kurt Mang
Hi all --
I hate to yell "BUG", but can anyone explain why I cannot
get a dropdown list / checkboxlist
to recognise the Value property of a ListItemCollection
(created at runtime) that I bind to it?
This is a simplified version of what I have. I see no
reason why this shouldn't work:
' Create the listitemcollection property:
Private ReadOnly Property ListMonths() As
ListItemCollection
Get
If Me._licMonths Is Nothing Then
Dim arrTemp As New
ListItemCollection
With arrTemp
.Add(New ListItem("Select
a month:", "00"))
.Add(New ListItem
("January", "01"))
.Add(New ListItem
("February", "02"))
.Add(New ListItem
("March", "03"))
.Add(New ListItem
("April", "04"))
.Add(New ListItem
("May", "05"))
.Add(New ListItem
("June", "06"))
.Add(New ListItem
("July", "07"))
.Add(New ListItem
("August", "08"))
.Add(New ListItem
("September", "09"))
.Add(New ListItem
("October", "10"))
.Add(New ListItem
("November", "11"))
.Add(New ListItem
("December", "12"))
End With
Me._licMonths = arrTemp
End If
Return Me._licMonths
End Get
End Property
' bind to a dropdown list: called in Page_Load
private sub PopulateDropDowns()
If Me.ddlDest1Month.Items.Count = 0 Then
With Me.ddlDest1Month
.DataSource = Me.ListMonths
.DataBind()
End With
End If
end sub
' the result (from view source of aspx page):
<select name="ucPreferences:ddlDest1Month"
id="ucPreferences_ddlDest1Month">
<option selected="selected" value="Select a
month:">Select a month:</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
Aargh! Why aren't my values being sent to the control?
Thanks for any help / insight / workarounds. I don't
want to resort to checking the Text property rather than
the Value property.
Kurt Mang
Vancouver, BC
I hate to yell "BUG", but can anyone explain why I cannot
get a dropdown list / checkboxlist
to recognise the Value property of a ListItemCollection
(created at runtime) that I bind to it?
This is a simplified version of what I have. I see no
reason why this shouldn't work:
' Create the listitemcollection property:
Private ReadOnly Property ListMonths() As
ListItemCollection
Get
If Me._licMonths Is Nothing Then
Dim arrTemp As New
ListItemCollection
With arrTemp
.Add(New ListItem("Select
a month:", "00"))
.Add(New ListItem
("January", "01"))
.Add(New ListItem
("February", "02"))
.Add(New ListItem
("March", "03"))
.Add(New ListItem
("April", "04"))
.Add(New ListItem
("May", "05"))
.Add(New ListItem
("June", "06"))
.Add(New ListItem
("July", "07"))
.Add(New ListItem
("August", "08"))
.Add(New ListItem
("September", "09"))
.Add(New ListItem
("October", "10"))
.Add(New ListItem
("November", "11"))
.Add(New ListItem
("December", "12"))
End With
Me._licMonths = arrTemp
End If
Return Me._licMonths
End Get
End Property
' bind to a dropdown list: called in Page_Load
private sub PopulateDropDowns()
If Me.ddlDest1Month.Items.Count = 0 Then
With Me.ddlDest1Month
.DataSource = Me.ListMonths
.DataBind()
End With
End If
end sub
' the result (from view source of aspx page):
<select name="ucPreferences:ddlDest1Month"
id="ucPreferences_ddlDest1Month">
<option selected="selected" value="Select a
month:">Select a month:</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
Aargh! Why aren't my values being sent to the control?
Thanks for any help / insight / workarounds. I don't
want to resort to checking the Text property rather than
the Value property.
Kurt Mang
Vancouver, BC