Click here to Skip to main content
12,349,363 members (65,807 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET MVC
Hi I am using anchor tag in my view in asp.net and open a popup through jquery on clicking on that anchor tag.
<a href="#" id="guarantor-link">@Model.Guarantor</a>
I want to apply required validation on the that anchor tag.
Its default value is select.
Please help how can I do that?
I have tried different solutions, but they didn't help me out.
Posted 18-Nov-12 19:08pm
v4
Comments
Zoltán Zörgő 18-Dec-12 8:07am
   
Validation has meaning for user input only. As clicking on a link can be treated as user input, validation makes sense (but not with DataAnnotation), but I can not figure out what exactly you want:
- on what user action
- what data should be checked
- and what values can be accepted as valid

BTW: legacy anchor syntax is (not supported in html5), but any visible element with id can be used as anchor.

1 solution

You don't need to use data annotation for validating this. Please write javascript or jquery script for validating this.
else add a hidden field with the property @Model.Guarantor and put required attribute for that property.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100