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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:06:01+00:00 2026-06-07T11:06:01+00:00

The entity framework connects to my database to retrieve columns, datatypes, relations, etc. It

  • 0

The entity framework connects to my database to retrieve columns, datatypes, relations, etc. It also knows which columns can be null and not null.

If I connect a regular asp.net grid to an entity datasource, it can generate the grid automatically based on the entity. It knows which fields should be a checkbox based on the datatype, etc.

Since data types are built into the entity class, can a regular asp.net control (like a grid or formview) also perform validation automatically? (or generate the necessary validation controls at least?)

Thanks,
Kevin

  • 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-07T11:06:03+00:00Added an answer on June 7, 2026 at 11:06 am

    Yes, you can display validation errors including validation types using asp:ValidationSummary control. Here one project with this approach used on gridview: http://code.msdn.microsoft.com/ASPNET-Web-Forms-97f8ee9a , check out editing students.
    The way to add more validation rules to entities is by attaching meta data.
    If you are using EF Code First you can apply rules directly else by adding meta data class, here example:

    [MetadataType(typeof(EntityNameMetaData))]
    public partial class EntityName {} // name of entity which want to add validation
    public class EntityNameMetaData // this is a place, where put validation rules
    {
        [StringLength(25, ErrorMessage = "First name must be 25 characters or less in length.")]
        [Required(ErrorMessage = "First name is required.")]]
         //custom or other validation rules
         public String EntityProperty
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

An app I'm currently working on uses Entity Framework 4 which connects to a
How can I connect to a database in Visual Studio with Entity Framework? I
Entity Framework has created the required partial classes. I can add these partial classes
.Net4 Entity Framework, N-Tier (so objects are detatched) I have 2 objects generated Database
The Entity Framework context object implements a Dispose() method which Releases the resources used
I'm using entity framework to connect with the database. I've one little problem: I've
I'm trying to generate my database tables from my Entity Framework model, but I'm
I was trying to use SQLite database using ADO.NET Entity Framework 5 and I
I'm using entity framework to connect the database. I've a table(Let's call it File)
Sql Server is accessible. I want to migrate database using Entity Framework migrations. There

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.