Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.NET component similar to old FieldSet

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
I used to be able to use Fieldset to group a collection of buttons, textboxes, and other form controls together and hide them all via
Code:
componentName.Disabled = True/False
. However, I do not see how to Disable, Enable that component in .Net using CodeBehind. Does anybody have an idea? How can I declare the component in my codebehind so that my code can control it?
 
protected withevents controlID as classType

right under the class declaration, which is where all your page objects (and anything else you want to have class scope) should be defined.
penny1.gif
penny1.gif
 
Okay, but what classType does what I want? Below you see a fieldset control with 3 RadioButtonLists in it. Using inline code I can control the functionality of all 3 by specifying addRT.Disabled = True/False. In code behind, to be able to do that I need to declare the control as you mentioned, but I don't know the class type for it. Perhaps .Net has a different control that will do similar. I'm simply trying to save myself from having to disable each one by themselves. In this case 3 is not bad, but what if I have 20 or more. I'll need 20 disable commands. This is a throwback from Asp Classic.
Code:
<fieldset id=&quot;addRT&quot; disabled=&quot;True&quot; runat=&quot;server&quot;>
 <legend><b>Additional Retouching</b></legend>
 <asp:RadioButtonList id=&quot;sHair&quot; tabIndex=&quot;19&quot; runat=&quot;server&quot; RepeatColumns=&quot;3&quot; RepeatDirection=&quot;Horizontal&quot;>
  <asp:ListItem Value=&quot;None&quot; SELECTED>None</asp:ListItem>
  <asp:ListItem Value=&quot;Simple&quot;>Simple</asp:ListItem>
  <asp:ListItem Value=&quot;Complex&quot;>Complex</asp:ListItem>
 </asp:RadioButtonList>
 <asp:RadioButtonList id=&quot;gGlare&quot; tabIndex=&quot;20&quot; runat=&quot;server&quot; RepeatColumns=&quot;3&quot; RepeatDirection=&quot;Horizontal&quot;>
  <asp:ListItem Value=&quot;None&quot; SELECTED>None</asp:ListItem>
  <asp:ListItem Value=&quot;Simple&quot;>Simple</asp:ListItem>
  <asp:ListItem Value=&quot;Complex&quot;>Complex</asp:ListItem>
 </asp:RadioButtonList>
 <asp:RadioButtonList id=&quot;rBraces&quot; tabIndex=&quot;21&quot; runat=&quot;server&quot; RepeatColumns=&quot;3&quot; RepeatDirection=&quot;Horizontal&quot;>
  <asp:ListItem Value=&quot;None&quot; SELECTED>None</asp:ListItem>
  <asp:ListItem Value=&quot;Simple&quot;>Simple</asp:ListItem>
  <asp:ListItem Value=&quot;Complex&quot;>Complex</asp:ListItem>
 </asp:RadioButtonList>
</fieldset>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top