How to show and hide html fieldset And also Set legend text from Asp.Net Code behind

Arun CM picture Arun CM · Nov 7, 2013 · Viewed 16k times · Source

I have a filedset and legend inside that with "some text" and inside this fieldset i have a GRID

I have 2 questions

  1. How to show ? hide html filedset from code behind, i tried the following way to show and hide the field set

    a) set runat="server"--but it didnt work b) i pasted the fieldset inside an asp.net panel and tried to show/hide the panel, it also didnt work

  2. How to set text for legend from code behind , ie I want to set "some text" + Value_Form_Code Behind AS leged text

Note :I am using "Rad Ajax Manager" and Rad Ajax LoadingPanel

Answer

meda picture meda · Nov 7, 2013
<asp:Panel ID="Panel1" runat="server" >                
<fieldlset>
<legend><asp:Label id="Label1" runat="server" /></legend>
</fieldset>
</asp:Panel>

How to show /hide html filedset from code behind ?

Panel1.Visible = true; // or false

How to set text for legend from code behind , ie I want to set "some text" + Value_Form_Code Behind AS legend text ?

Label1.Text = String.Format("some text {0}",Value_Form_Code);