J
Jim French
I thought I would share this (semi) annoying issue I had. Basically, the
DropDownList I was trying to bind inside a Repeater with the ItemDataBound
event was not working - instead of a normal listbox, I was getting a row of
string values. The problem was that I left out the closing '>' from the
literal control that was directly in front of the DDL.
Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater1.ItemDataBound
'Bind Name
CType(e.Item.FindControl("litName"), Literal).Text = "<p><b>" &
objDS.Tables("Table2").Rows(e.Item.ItemIndex).Item("personame") & "</b></p"
<-----
'Bind DropDownList
Dim lstWho As DropDownList = CType(e.Item.FindControl("lstwho"),
DropDownList)
lstWho.DataSource = objDS.Tables("Table1")
lstWho.DataTextField = "Name"
lstWho.DataValueField = "ID"
lstWho.DataBind()
End Sub
Hope that can help someone save some time someday!
DropDownList I was trying to bind inside a Repeater with the ItemDataBound
event was not working - instead of a normal listbox, I was getting a row of
string values. The problem was that I left out the closing '>' from the
literal control that was directly in front of the DDL.
Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater1.ItemDataBound
'Bind Name
CType(e.Item.FindControl("litName"), Literal).Text = "<p><b>" &
objDS.Tables("Table2").Rows(e.Item.ItemIndex).Item("personame") & "</b></p"
<-----
'Bind DropDownList
Dim lstWho As DropDownList = CType(e.Item.FindControl("lstwho"),
DropDownList)
lstWho.DataSource = objDS.Tables("Table1")
lstWho.DataTextField = "Name"
lstWho.DataValueField = "ID"
lstWho.DataBind()
End Sub
Hope that can help someone save some time someday!