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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:48:05+00:00 2026-05-24T18:48:05+00:00

i am enabling the user using my asp.net application to add data into a

  • 0

i am enabling the user using my asp.net application to add data into a sql server 2008 database.

what is the best way to insert data and be able to validate things like empty fields, integers vs strings?

i am currently using formview to insert the data. how do i validate user input?

  • 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-24T18:48:06+00:00Added an answer on May 24, 2026 at 6:48 pm

    Use a validation jQuery plugin for front end validation.

    This is the one I use a lot. http://bassistance.de/jquery-plugins/jquery-plugin-validation/

    Then in c# create a partial class of your model and use DataAnnotations to do some more in depth validation.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel;
    
        namespace DataRepository
        {
            [MetadataType(typeof(Company_validation))]
            public partial class Company
            {
            }
    
    
            public class Company_validation
            {
                [Required]
                [DisplayName("Company name")]
                public string Name { get; set; }
    
                [Required]
                [DisplayName("Address")]
                public string AddressLine1 { get; set; }
                public string AddressLine2 { get; set; }
    
                [Required]
                public string Suburb { get; set; }
    
                [Required]
                public int Postcode { get; set; }
    
                [Required]
                public string State { get; set; }
            }
    
        }
    

    So from here you can pretty much do any validation you would ever need.

    Here are two examples of RequiredFieldValidators we used in a project once.

    The RegularExpressions validator is the one you want to check against string vs int etc or to validate phone number, postcode or email;

    <asp:RequiredFieldValidator ID="reqValTxtAppRef" runat="server" ErrorMessage="Please enter your application reference number or <a href='ChooseYourHealthCover.aspx'>click here</a> to begin a new application <br/>"
    ControlToValidate="txtAppRef" Display="Dynamic" ValidationGroup="vgRetrieveApp"
    SetFocusOnError="true" CssClass="error" Font-Bold="true" cau EnableClientScript="False" />
    
    <asp:RegularExpressionValidator ID="regexpValTxtAppRef" runat="server" ControlToValidate="txtAppRef" ErrorMessage="This is not a valid application reference number. Please enter it again or <a href='ChooseYourHealthCover.aspx'>click here</a> to begin a new application <br>" ValidationExpression="(HQ|HA|hq|ha)\d{8}" ValidationGroup="vgRetrieveApp" Display="Dynamic" CssClass="error" Font-Bold="true" EnableClientScript="False" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are disabling and enabling foreign key constraints supported in SQL Server? Or is my
What are some best practices on enabling a web application to support multiple resolutions?
Is there a way to enabling collapsing of functions and sub-routines for Classic ASP
I've built an ASP.NET MVC application with MVC 2.0 and Fluent NHibernate (hided behind
I have been using ASP.NET MVC for six months or so and have been
I've written an Microsoft Excel add-in in .NET using Add-in Express , and deployed
I am working on an ASP.NET MVC 2 application and am struggling to get
I am working on an intranet website using ASP.NET and was wondering what exactly
Is anyone aware of any gems, tutorials, or solutions enabling a user to sign
What are differences between enabling and disabling Enable 32-Bit applications in websites application pools

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.