开发者

how to placer asterisks by required field plus jquery validation

I am wondering how I would place an asterisk by a r开发者_运维百科equired field and also have the jquery validation message also there. I am a complete noob at jquery so I am kind of confused about how to do this?


here is what can sum it up

first part: How to implement asterix by required field

Option1: define asterix in display name

[DisplayName("User Name *")]  //this will be defined in entity or model
<%= Html.LabelFor(x=>x.Name) %> //access data

Option 2: using label and add manually span with asterix

[DisplayName("User Name")]
<%= Html.LabelFor(x=>x.Name) %><span>*</span>

for second part( validation using jquery) check this link it is guide how to implement client side validation using jquery:

http://weblogs.asp.net/nmarun/archive/2010/03/21/mvc-2-jquery-client-side-validation.aspx
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜