burak Posted September 28, 2004 Posted September 28, 2004 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 Quote
Moderators Robby Posted September 28, 2004 Moderators Posted September 28, 2004 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 Quote Visit...Bassic Software
wessamzeidan Posted October 1, 2004 Posted October 1, 2004 Remember that if you add a dynamic control to a webform, you have to recreate it and added to the controls collection at every postback Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
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.