Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
When I disable the Javascript in the browser and without filling the fields I click the submit button then I cant see the Server Side Validation message, whats wrong with the below code?
 
<asp:Panel ID="Panel1" runat="server">
            <table class="style4">
             <tr>
                 <td class="style9">
                     <asp:Label ID="Label2" runat="server" Text="Name" Font-Bold="True" ForeColor="#FFD028">
                 </td>
                 <td class="style10">
                     <asp:TextBox ID="TxtName" runat="server" CssClass="Roundedcorner" 
                         ToolTip="Name" CausesValidation="True">
                 </td>
                 <td class="style11">
                      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                          ControlToValidate="TxtName" ErrorMessage="*" ValidationGroup="Contact" 
                          Display="Dynamic">Please 
                      fill  <asp:RegularExpressionValidator 
                          ID="RegularExpressionValidator1" runat="server"
                         ErrorMessage="*" ControlToValidate="TxtName" Display="Dynamic" 
                          ValidationExpression="^([a-zA-z\s]{2,32})$" ValidationGroup="Contact">Alphabets only
                 </td>
             </tr>
             <tr>
                 <td class="style8">
                     <asp:Label ID="Label3" runat="server" Text="Email Id" Font-Bold="True" ForeColor="#FFD028">
                 </td>
                 <td class="style7">
                     <asp:TextBox ID="TxtEmail" runat="server" CssClass="Roundedcorner" 
                         ToolTip="Email Id" CausesValidation="True">
                 </td>
                 <td>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                         ControlToValidate="TxtEmail" Display="Dynamic" ErrorMessage="*" 
                         ToolTip="Email Id" ValidationGroup="Contact">Please fill
                     <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                         ControlToValidate="TxtEmail" Display="Dynamic" ErrorMessage="*" 
                         ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                         ValidationGroup="Contact">
                 </td>
             </tr>
             <tr>
                 <td class="style8">
                     <asp:Label ID="Label4" runat="server" Text="Contact Number" Font-Bold="True" ForeColor="#FFD028">
                 </td>
                 <td class="style7">
                     <asp:TextBox ID="TxtContact" runat="server" CssClass="Roundedcorner" 
                         ToolTip="Contact Number" CausesValidation="True">
                 </td>
                 <td>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                         ControlToValidate="TxtContact" ErrorMessage="*" ValidationGroup="Contact" 
                         Display="Dynamic">Please 
                     fill
                     <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                         Display="Dynamic" ErrorMessage="*" ValidationExpression="^[0-9]{6,10}$" 
                         ControlToValidate="TxtContact">Numbers 
                     only
                 </td>
             </tr>
             <tr>
                 <td class="style8">
                     <asp:Label ID="Label5" runat="server" Text="Your Message" Font-Bold="True" Font-Italic="False"
                         Font-Strikeout="False" Font-Underline="False" ForeColor="#FFD028">
                 </td>
                 <td class="style7">
                     <asp:TextBox ID="TxtMessage" runat="server" CssClass="Roundedcorner" 
                         TextMode="MultiLine" Width="131px" ToolTip="Feedback Message" 
                         CausesValidation="True">
                 </td>
                 <td>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                         ControlToValidate="TxtMessage" Display="Dynamic" ErrorMessage="*" 
                         ValidationGroup="Contact">Cannot be blank
                 </td>
             </tr>
             <tr><td colspan="3"></td></tr>
             <tr>
                 <td class="style8">
                       </td>
                 <td class="style7">
                     <asp:Button ID="BtnSubmit" runat="server" CssClass="css3button" Text="Submit"
                         OnClick="BtnSubmit_Click1" ValidationGroup="Contact" Height="34px" 
                         Width="94px" />
                 </td>
                 <td>
                      
                 </td>
             </tr>
             <tr>
                 <td class="style8">
                      
                 </td>
                 <td class="style7">
                    
                 </td>
                 <td>
                      
                 </td>
             </tr>
         </table>
        <asp:Panel ID="Panel2" runat="server" 
                   style="top: 95px; left: 38px; position: absolute; height: 19px; width: 321px">
               <br />
             
                   <table>
                   <tr><td><asp:Image ID="Image2" runat="server" ImageUrl="images/Right1.png" Height="33px" 
                   Width="46px" /></td>
                   <td><p style="font-size:11pt;font-family:Comic Sans MS; color: #FFD028; font-weight: 700;">We have received your feedback</p></td>
                   </tr>
                   </table>
                   
Posted 2-Feb-13 20:49pm
Edited 2-Feb-13 21:08pm
v2
Comments
Sandeep Mewara at 3-Feb-13 3:11am
   
You say, on disabling JS you cant see the Server Side Validation message?
In other words, whole page is re-rendered post postback and yet you fail to see the message set by server?
DevashishDas at 4-Feb-13 10:45am
   
Yes, am using a panel to display the successful message to the user and the first panel is hidden when all the details are filled correctly, as the user gets a Thankyou mail with the success message. Is it because of the panels?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

As far as I remember postback on the client side is handled via .NET auto-generated JavaScript, having JS disabled seems like a way to sterilize the browser.
 
I doubt if you could get a functional ASP.NET page without JS, unless you are using silverlight, flash, applets or another solution.
 
Cheers,
Edo
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 210
1 Richard MacCutchan 100
2 kbrandwijk 90
3 ChauhanAjay 80
4 ProgramFOX 80
0 Sergey Alexandrovich Kryukov 9,050
1 OriginalGriff 8,151
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100