【发布时间】:2011-07-22 09:41:10
【问题描述】:
我在下面给出的 jquery 模板中有一个 asp:textbox
<script id="ProjectTypeTemplate" type="text/x-jquery-tmpl">
<tr id="trProjType">
<td>${lang_id} </td>
<td><input id="${lang_id}" type="text" /> <span class="RequiredFieldStar">*</span></td>
<td>${merchant_id}</td>
<td>${lang_id}</td>
<td>${name_lang}</td>
</tr>
</script>
我必须为它做类似这样的验证
<div id = "Projtypediv">
<table id = "project_type_templ_tbl" border="1" cellspacing="0" style="width:100%;">
<asp:RequiredFieldValidator ID="reqvProjectTypeDescription" runat="server" ErrorMessage="Enter Project Type Description"
ControlToValidate="Id of the inputbox" Display="None"></asp:RequiredFieldValidator> <ajaxToolkit:ValidatorCalloutExtender
runat="Server" ID="vceProjectTypeDescription" TargetControlID="reqvProjectTypeDescription" />
<asp:CustomValidator runat="server" ID="custvProjectTypeDescription" ErrorMessage="Enter characters except (<,>,&#,\) in Project Type Description"
ControlToValidate="Id of the inputbox" Display="None" ClientValidationFunction="checkSpecialCharacter" />
<ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="vceSpCharacterProjectTypeDescription"
TargetControlID="custvProjectTypeDescription" />
</table>
</div>
其中 project_type_templ_tbl 是包含模板的表的名称
提前感谢您的帮助
【问题讨论】:
-
通过 javascript 触发验证是您的一种情况,或者您是否正在寻找使用服务器端 C# 的解决方案?
标签: c# jquery-templates