[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ASP .net  Escape page validation

Posted on 2004-10-13
5
Medium Priority
?
383 Views
Last Modified: 2010-04-06
Dear experts,

I have a renew password web form. As the name says, it renews user password.
 
In which, there are web contorls such as new password textbox and confirm password textbox  that are validated by validation controls. For example, if the password textboxes are empty, it simply invalid the page.

The page also has a hyperlink button "Renew Later", for user to have an option to renew the account at a later time. Once user click on the hyperlink button, it redirect user to some other page.

The problem with this set up is if the user just click on the hyperlink button "Renew Later" without entering password, it triggers the page validation control. Is there a simple way to escape the validation?

Thanks

etalexit
0
Comment
Question by:etalexit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12302494
We'll need to see code I think.

Cd&
0
 

Author Comment

by:etalexit
ID: 12302621
Below is the code sample.
When user click on the hyperlink button "Later", since there is no password entered, the validator invalide the page.
Is there a way to escape the validation when "Later" is clicked and call the code behind function Sub lnkCancel_Click in order to singout the user

---------------------------------------------------------------------------

renew.aspx

<html>
<body>
<form id="Form2" method="post" runat="server">
<asp:LinkButton id="lnkCancel" runat="server">Later</asp:LinkButton
<TABLE id="Renew" style="WIDTH: 374px; HEIGHT: 264px" width="374" align="center">
<TR>
      <TH bgColor="#b70000" colSpan="2">
            <FONT color="#ffffff">Renew Password</FONT></TH></TR>
<TR>
      <TD colSpan="2">User Name:</TD>
</TR>
<TR>
      <TD align="left" colSpan="2"><asp:textbox id="txtUNM" runat="server" ToolTip="Registered User Name" ForeColor="#400000" MaxLength="15"
                  Width="100%" BorderStyle="None" Enabled="False"></asp:textbox></TD>
</TR>
<TR>
      <td colSpan="2">Existing Password:</td>
</TR>
<tr>
      <td style="HEIGHT: 24px" align="left" colSpan="2"><asp:textbox id="txtOldPwd" runat="server" ToolTip="Existing Password" ForeColor="#400000" Width="100%"
                  TextMode="Password"></asp:textbox><asp:requiredfieldvalidator id="valExistingPwd" runat="server" ErrorMessage="**Please enter the existing password"
                  ControlToValidate="txtOldPwd"></asp:requiredfieldvalidator></td>
</tr>
<tr>
      <td colSpan="2">New Password:</td>
</tr>
<tr>
      <td style="HEIGHT: 53px" align="left" colSpan="2"><asp:textbox id="txtNewPwd" runat="server" ToolTip="New Password" ForeColor="#400000" Width="100%"
                  TextMode="Password"></asp:textbox><asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" ErrorMessage="**Invalid password combination"
                  ControlToValidate="txtNewPwd" ValidationExpression="(?=^.{8,20}$)((?=.*\d)(?=.*[A-Z]) (?=.*[a-z])(?!.*\s)|(?=.*\d)(?=.*[^A-Za-z0-9]) (?=.*[a-z])(?!.*\s)|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]) (?!.*\s)|(?!.*\s)(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*"> </asp:regularexpressionvalidator></td>
</tr>
<tr>
      <td colSpan="2">Confirm New Password:</td>
</tr>
<tr>
      <td style="HEIGHT: 24px" align="left" colSpan="2"><asp:textbox id="txtNewConfPwd" runat="server" ToolTip="Cofirm New Password" ForeColor="#400000"
                  Width="100%" TextMode="Password"></asp:textbox><asp:comparevalidator id="valNewConfPwd" runat="server" ErrorMessage="**Confirm password does not match  new password"
                  ControlToValidate="txtNewConfPwd" ControlToCompare="txtNewPwd"></asp:comparevalidator></td>
</tr>
<tr>
      <td class="bodyText" colSpan="2"></td>
</tr>
<tr>
      <td align="right" colSpan="2"><asp:button id="btnOK" runat="server" ToolTip="Reset Password. Password will be emailed to your account."
                  ForeColor="#400000" Width="36px" BorderStyle="Solid" BackColor="#FFC0C0" BorderColor="#400000" Text="OK"></asp:button></td>
</tr>
</TABLE>
</td>
</tr>
</table>
</form>
</html>
-----------------------------------------------------------------
renew.aspx.vb
    Private Sub lnkCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkCancel.Click
            FormsAuthentication.SignOut()
    End Sub


0
 

Author Comment

by:etalexit
ID: 12311435
Got it. The solution is really simple. Set the CauseValidation property = false.

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12577702
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question