Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

Is it possible in asp.net to load standard controls like checkboxes, buttons, etc dynamically?

 

For example, let say I have a table in a database with 10 rows, can I load and show just 10 checkboxes on a page?

 

I am completely newbie in asp.net, so if adding standard web controls dynamically is possible, I would appreciate links to any good tutorials about the subject.

 

Thanks all for reading this boring newbie question :)

Posted

Yes:

 

Dim c As Control = LoadControl("MyUserControl.ascx")

 

Or

 

Dim btnTest As New LinkButton

btnTest.ID = "DynamicallyAddedButton"

btnTest.Text = "Test"

'etc.

 

MyPlaceHolder.Controls.Add(btnTest)

 

Or do this with any naming container type of control.

 

Google ".NET Controls.Add" and I'm sure you'll have thousands of hits...

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...