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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:27:23+00:00 2026-06-04T17:27:23+00:00

I might actually be going insane, but I can’t find a single example of

  • 0

I might actually be going insane, but I can’t find a single example of how to use DataAnnotationsExtensions with Visual Basic in MVC 3. I’m tired of guessing.

Anyone one want to point me to an example or provide some simple code to show me how to use the tags?

Thank you!!

  • 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-04T17:27:25+00:00Added an answer on June 4, 2026 at 5:27 pm

    Well, it’s pretty straightforward actually.

    1. You create a new ASP.NET MVC 3 application
    2. You install the DataAnnotationsExtensions.MVC3 Nuget
    3. You create a view model:

      Public Class MyViewModel
          <CreditCard(ErrorMessage:="Invalid credit card number")>
          Public Property Number As String
      End Class
      
    4. A controller:

      Public Class HomeController
          Inherits System.Web.Mvc.Controller
      
          Function Index() As ActionResult
              Return View(New MyViewModel())
          End Function
      
          <HttpPost()>
          Function Index(ByVal model As MyViewModel) As ActionResult
              Return View(model)
          End Function
      End Class
      
    5. And finally a view:

      @ModelType AppName.MyViewModel
      
      @Using Html.BeginForm()
          @Html.LabelFor(Function(x) x.Number)
          @Html.EditorFor(Function(x) x.Number)
          @Html.ValidationMessageFor(Function(x) x.Number)
          @<button type="submit">OK</button>
      End Using
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It might seem a little dull and basic, but I'm actually having trouble to
Might look a silly question, but can I return an instance? Example: public class
This might be an odd question, but it has actually caused me some headache.
This might be a long shot, but I'm going to put it on here
I might be wrong about what is actually happening here but i have 3
Before I describe my problem, it might actually make it clearer if I start
So from my understanding of Java, when you write return value; It might actually
Might be a bit of noob question but it's something that's been getting me
might be a stupid question but I seem to be confused. Im pretty new
Might be a stupid question but in our iOS app we're storing an integer

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.