在ascx页面上进行jquery验证 [英] jquery validation on ascx page

查看:83
本文介绍了在ascx页面上进行jquery验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的aspx页面中,我添加了两个带有differentIds的applicant.ascx实例,但是在呈现时,它将为这些用户控件中的控件呈现为相同的ID.使用jquery验证时仅验证一个ascx控件.我该如何解决?任何人都请

In my aspx page, I have added two instance of applicant.ascx with differentIds but when it renders it will render as identical Id for controls within those user controls. when validating with jquery It only validates for one ascx control. how do I resolve this? any one please

推荐答案

我还没有搞砸任何事情.验证规则对于ascx页面可以正常工作.这是您可以重现行为的步骤
创建aspx页面,向其中添加一个ascx,例如
I have not screwed up anything. the validation rule works as expected for a ascx page. here is a steps you can reproduce the behaviour
create aspx page, add a ascx to it e.g.
<uc5:usrapplicant id="usrApplicant1"  runat="server" xmlns:uc5="#unknown"></uc5:usrapplicant> and add another one
<uc5:usrapplicant id="usrApplicant2"  runat="server" xmlns:uc5="#unknown"></uc5:usrapplicant>


在此用户控件中创建一个控件


in this usercontrol create a control

<input name="txtAddress1" type="text" id="txtAddress1" class="txtAddress1" size="40"  runat="server" />


并在jquery验证中添加一条规则以使该字段为必填.
在aspx中渲染时,会有重复的ID,即txtAddress1,我的问题是我如何将类渲染为txtAddress2或其他东西,以便我可以进行验证.基于那些类.谢谢


and in jquery validation add a rule to make the field required.
when rendering in aspx there will be duplicate IDs i.e. txtAddress1, my question is how can I render class as txtAddress2 or something so that I could do my validations. based on those class. thank you


这篇关于在ascx页面上进行jquery验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆