eramgarden Posted May 7, 2004 Posted May 7, 2004 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? 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 Quote
LostProgrammer Posted May 7, 2004 Posted May 7, 2004 use the item property of the event args. then use findcontrol. e.item.findcontrol("cntrl") or iterate through the datalist and retrieve the controls by indexing the item ddl = item.controls(0) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.