Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...