Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NETMVC
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
Edited 18-Nov-12 19:36pm
Tadit Dash84.4K
v4
Comments
Zoltán Zörgő at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,588
1 OriginalGriff 528
2 Manas Bhardwaj 383
3 Damith Weerasinghe 330
4 Tadit Dash 315
0 Sergey Alexandrovich Kryukov 9,575
1 OriginalGriff 6,006
2 Peter Leow 4,500
3 Maciej Los 3,540
4 Abhinav S 3,513


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid