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 7063701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:44:40+00:00 2026-05-28T04:44:40+00:00

I am trying to build a web application that requires users to register themselves.

  • 0

I am trying to build a web application that requires users to register themselves.
I added custom validators and other validators according to my need.

Part of the code in .aspx file

<form id="form" name="form" action="../Hi.aspx" method="post">
<table cellspacing="4" class="style1">
    <tr>
<td class="style4">
<asp:TextBox ID="TxtFirstName" runat="server" Width="157px"></asp:TextBox>
</td>
td class="style5" id="FName">
<asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TxtFirstName" 
 ErrorMessage="Your First Name should be at least 2 characters long" 
 onservervalidate="CustomValidator1_ServerValidate" ForeColor="Red" 
 ValidateEmptyText="True"></asp:CustomValidator>...

and correspnding code in .aspx.cs file is

protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = (args.Value.Length>1);
        }

This works fine when I run only this part of the application.

Now, I want to retrieve the values of all the text fields and store them in a database.

In aspx.cs file, i wrote code as

 protected void ButtonRegister_Click(object sender, EventArgs e)
 {
      string fname = TxtFirstName.Text;
      Controllers.RegistrationController r = new Controllers.RegistrationController();
      int a = r.registerData(fname);
      if (a==1) {
           Response.Redirect("../Hi.aspx");
      }
 }     

which is called when the submit button is clicked.

The registerData() method in the RegistrationController that established connection with the database and stores the form values.
The connection is established correctly and the values are retrieved and stored.
But, the problem is, when i call the registerData() method from the method ButtonRegister_Click, all the validation that I have written doesn’t work. Anything that is entered in the form gets stored into the database without validation.

How do I retrieve the values and store them and at the same time ensure that they are being validated?

I am new to .net, so any help is appreciated.

Thank you very much in advance.

  • 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-05-28T04:44:41+00:00Added an answer on May 28, 2026 at 4:44 am

    You could call Page.Validate within your click method and check the result of that or specifying CausesValidation on your button should cause the valdation to run

    In the long term though you might want to look at moving the rules to a lower lower (ie. business logic) such that when/if you move to supporting services you wont have to reimplement the rules in those services, of course if you’re not ever planning to do that getting away with them on the ui may suffice

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a web application that enables users to refer people
We are trying to build an web application that allows users to select appropriate
I'm trying to build a web service using Ruby on Rails. Users authenticate themselves
I am trying to build a Google Maps-driven web application that can display a
Need of time server services I am trying to build a web application in
I'm trying to build a web application that let the administrator talk to the
I'm trying to build a web application that generates a random number within a
I'm trying to build a web application in which users can invite their friends
I am trying to build an application in Windows Azure that requires notifications -
I am trying to build a web application that will take an scan paper

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.