Jump to content
Xtreme .Net Talk

How do you access a dynamically created control's values on the server side?


Recommended Posts

Posted

Hello,

 

I would like to dynamically create a radio button by

assigning this string to a label or a literal

 

<input type="radio" name="AJB" value="YES"

onClick="javascript:toggle('YES','radGrantAllPermissions');"

runat="server" id="Radio1">

 

How would I then access this control on the server

side?

 

Thank you,

 

Burak

  • Moderators
Posted

Instead of creating the string as a literal you can add the control as an asp control

 

Dim myRadio as new radioButton

 

myPanel.Controls.Add(myRadio)

myRadio.Attibutes.Add("OnClick", "javascript:toggle('YES','radGrantAllPermissions');")

myRadio.ID = "Radio1"

 

Then to find the control....

 

 

Dim myRadio as new radiobutton

 

myRadio = DirectCast( myPanel.FindControls("Radio1"),RadioButton)

If not myRadio is nothing then

'do something with the radio button

else

'we did not find the control

end if

Visit...Bassic Software

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