Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8302333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:15:50+00:00 2026-06-08T17:15:50+00:00

Below is my mark up. <asp:TextBox ID=txtPatientDateOfBirth runat=server CssClass=rightDivInnerControls ClientIDMode=Static CausesValidation=True> </asp:TextBox> <asp:CompareValidator ID=cvPatientDateOfBirth

  • 0
Below is my mark up. 

<asp:TextBox ID="txtPatientDateOfBirth" runat="server" 
    CssClass="rightDivInnerControls" ClientIDMode="Static" 
    CausesValidation="True">
</asp:TextBox>
<asp:CompareValidator ID="cvPatientDateOfBirth" runat="server" 
    ErrorMessage="Enter proper date." 
    Type="Date" ControlToValidate="txtPatientDateOfBirth" Font-Bold="True"  
    Operator="DataTypeCheck"
    ValidationGroup="FirstPreview">
</asp:CompareValidator>    

<asp:Button ID="btnSaveChanges" runat="server" 
    Text="Save Changes"  OnClientClick="return showFinalReviewAlert();" 
    CssClass="btnPrimary hideInPrint btnEditFinalReport" 
    ValidationGroup="FirstPreview" 
    onclick="btnSaveChanges_Click"  ClientIDMode="Static"/>

When I change the date to a wrong format it shows me the error message immediately.

enter image description here

But when I click on the button “btnSaveChanges” it does a postback. I think something is missing because of which it is doing postback.

Can anyone please help me with the issue. I want to stop the postback if validation fails.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:15:52+00:00Added an answer on June 8, 2026 at 5:15 pm

    By returning the value of showFinalReviewAlert(); in the OnClientClick of the button, you are blocking the page validation from happening.

    This is effectively the HTML that is being rendered (simplified for viewing)…

    <input type="submit" 
           id="btnSaveChanges" 
           onclick="return showFinalReviewAlert();WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnSaveChanges;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" 
           name="btnSaveChanges">
    

    The important bit of this is…

    onclick="return showFinalReviewAlert();WebForm_DoPostBackWithOptions....
    

    What it means is that no matter what showFinalReviewAlert() returns, the WebForm_DoPostBackWithOptions will never be reached. However, because it is an <input type="submit"> the page will post-pack to the server anyway.

    So, if the return value of the showFinalReviewAlert must stop the post-back from happening by returning the value false, you should set the OnClientClick attribute as this…

    OnClientClick="if(showFinalReviewAlert()==false){return false;}"
    

    In other words, if showFinalReviewAlert return false then stop the button from continuing any post-back processing… but if it return true, then allow the post-back validation to take place.

    On the other hand, if the result of showFinalReviewAlert() doesn’t matter… simply remove the return to give simply…

    OnClientClick="showFinalReviewAlert();"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a gridview I have the following Template Field containing a textbox <asp:TemplateField ShowHeader=true
Trying to mark radio inputs as selected with XSLT 1.0 using the below xslt
The link below works fine unless the variable $row[title] contains a double-quotation mark ().
Below is the code from internalRegister method of GCMRegistrar class static void internalRegister(Context context,
I have a string as below $str = 'Mark Zuckerberg facebook A social utility
I want to put data in javascript array like below. Carl, 56 Mark, 7
In the line below where it shows return(!variable); what does the exclamation mark do
In the iOS UIViewController code below, I connect to a server that uses a
I'm unable to find the textbox control in a gridview. And the below code
I have two tables as shown below EmpMaster empid firstName lastName lstatus 1 Mark

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.