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

  • SEARCH
  • Home
  • 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 8207045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:52:44+00:00 2026-06-07T08:52:44+00:00

I have a field on an asp.net page for which I have used RequiredFieldValidator

  • 0

I have a field on an asp.net page for which I have used RequiredFieldValidator.

<tr> 
  <td align="left" style="width: 130px"> 
    <asp:Label ID="LblPagename" runat="server" Text="Page Name " CssClass="label"></asp:Label><font 
      color="red"> *</font> 
  </td> 
  <td align="left" style="width: 1087px" class="layout-grid"> 
    <asp:TextBox ID="TxtPageName" runat="server" MaxLength="50" ></asp:TextBox> 
    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" Display="Dynamic" 
      ValidationGroup="Save" ControlToValidate="TxtPageName" ForeColor="Red"
      ErrorMessage="Please enter Page Name."></asp:RequiredFieldValidator>  
  </td> 
</tr>

on save I am allowing CauseValidation="true" for the the same ValidationGroup as mentioned above

<tr> 
  <td colspan="3" align="center" style="width: 1193px"> 
    <asp:ImageButton ID="btnMenu" CausesValidation="true" ValidationGroup="Save" ImageUrl="~/Images/Save.png"  
      runat="server" OnClick="btnMenu_Click" OnClientClick="SaveFunctionalities();"/> 
    &nbsp;&nbsp; &nbsp;&nbsp; 
    <asp:ImageButton ID="btnCancelMenu" ImageUrl="~/Images/btnCancel.png" runat="server" 
      OnClick="btnCancelMenu_Click" /> 
  </td> 
</tr>

But on save, along with the error message for the empty field, the save is being called.

The same thing is working fine on other pages.

The only difference is that here I have a javascript function call on OnClientClick.

Is that causing some problem?

  • 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-07T08:52:46+00:00Added an answer on June 7, 2026 at 8:52 am

    Make sure that SaveFunctionalities(); returns a boolean value, depending on whether an error has occured or not. If everything is fine, then return true – if there are any errors return false.

    Then update your OnClientClick to pass that return variable to the button..

    OnClientClick="return SaveFunctionalities();"
    

    If there are no problems, the button will continue as normal via the true value. If there are errors, then it will be told to stop processing via the false value.

    UPDATE

    From the code posted in the comment by @Richa, you are always returning false, no matter what the validation returns.

    Your function should look more like this…

    function SaveFunctionalities() {
      if (Page_ClientValidate()) {
        ...
        return true;
      } else {
        return false; 
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some JavaScript to toggle a dropdownlists in a ASP.NET page, which gets
I have an ASP.net Login Control which has a link to CreateUserWizard page(register). When
If I have an MVC3 ASP.net page which contains a the model iEnumerable<mymodel.CarsForHire> -
In my ASP.Net page, i have a few link button controls which are placed
I have an ASP.NET page which has a script manager on it. <form id=form1
I have one Asp.net MVC3 page which renders details of a Mobile. This page
Simple question. I have the following hidden input field on my ASP.NET page: <form
I am very new to asp.net... I have to create a page which looks
If I wanted to conditionally set which field should have focus using ASP.NET WebForms,
I have used the ASP.NET Hidden field control, allowing me to generate single-item data

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.