eramgarden
Contributor
- Joined
- Mar 8, 2004
- Messages
- 579
Cant find examples of what i want to do:
I have a repeater "rpAct". It has a dropdownlist in it "ddlActTypes"...
I want to bind data to this dropdownlist but first I need to find the control
I've tried you name it and find this control in Repeater. Tried onItemDataBound, etc. This is what I have and the control comes out as Nothing.
What am I missing?
I have a repeater "rpAct". It has a dropdownlist in it "ddlActTypes"...
I want to bind data to this dropdownlist but first I need to find the control
I've tried you name it and find this control in Repeater. Tried onItemDataBound, etc. This is what I have and the control comes out as Nothing.
What am I missing?
Code:
Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
[b] Dim ddl As New DropDownList()
ddl = CType(rpAct.FindControl("ddlActTypes"), DropDownList)[/b]
While dr.Read
Dim newListItem As New ListItem()
newListItem.Value = dr.GetValue(0)
newListItem.Text = dr.GetString(1)
[b]ddl.Items.Add(newListItem)[/b] 'FAILS HERE
End While