Link to home
Start Free TrialLog in
Avatar of solution1368

asked on, radiobuttonlist validation

2 questions from the following codes

1. If I take out visible="false", everything is working. How to fix it with default visible is false in the panel?

2. The following controls are in the asp.wizard. basically, if radio button value is "yes",
the user is supposed to type something in the textbox. How can I validate when the user click on next button inside of the wizard control?


<asp:RadioButtonList runat="server" RepeatLayout="Flow"  ID="StuntSpecialHazards" TextAlign="Left" RepeatDirection="Horizontal">
<asp:ListItem Value="Yes" Text="Yes"></asp:ListItem><asp:ListItem Value="No" Text="No"></asp:ListItem></asp:RadioButtonList>
<asp:RequiredFieldValidator CssClass="BoldAndRed" ID="RequiredFieldValidatorStuntSpecialHazards" runat="server" ErrorMessage="*" SetFocusOnError="true" Display="Dynamic" ControlToValidate="StuntSpecialHazards"></asp:RequiredFieldValidator>
<br />
<script type="text/javascript">
     $("#<%=StuntSpecialHazards.ClientID%>").change(function () {
         var rbvalue = $("input[name='<%=StuntSpecialHazards.UniqueID%>']:radio:checked").val();
         if (rbvalue == "Yes")
             $('#<%= PanelStuntSpecialHazards.ClientID %>').show('slow');
         else if (rbvalue == "No")
             $('#<%= PanelStuntSpecialHazards.ClientID %>').hide('slow');
<asp:Panel runat="server" ID="PanelStuntSpecialHazards" visible="false">
<asp:TextBox runat="server" ID="StuntSpecialHazardsDescription" TextMode="MultiLine" Height="50"></asp:TextBox>
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of solution1368


Tried it with page_init and page_load. Still not working.

  protected void Page_Init(object sender, EventArgs e)
           StuntSpecialHazardsDescription.Visible = false;
Did you set the visibility of PanelStuntSpecialHazards or of the textbox.

Doing it in Load should do it for you.
PanelStuntSpecialHazards set it to visible = false on page onload and still not working