【发布时间】:2011-04-14 00:00:12
【问题描述】:
我有一个对话框,允许用户在提交到服务器之前输入一些文本。文字为必填项。
我的代码是这样的
这是打开对话框的 Jquery 代码
function onReportThis() {
$("#dialog-Report").dialog({
resizable: false,
modal: true,
width: '400px',
buttons: {
Submit: function () {
__doPostBack('<%= lnkReportThis.UniqueID %>', '');
// onReported();
},
Cancel: function () {
$(this).dialog("close");
}
}
});
$("#dialog-Report").parent().appendTo(jQuery("form:first"));
return false;
}
这是盒子本身的代码。
<div id="dialog-Report" style="display: none" title="Report This Profile">
<p>
I am reporting this profile because</p>
<asp:RequiredFieldValidator ID="validReportText" ControlToValidate="txtReportDetail" runat="server" ErrorMessage="Please enter text" ></asp:RequiredFieldValidator>
<p>
Please enter additional details regarding why you are reporting this profile</p>
<asp:TextBox ID="txtReportDetail" runat="server" Width="300px" Height="300px" TextMode="MultiLine" />
</div>
在回调之前未使用必填字段验证器。我怎样才能让它工作?谢谢
更新:我已经开始工作了。
我必须这样做。
if (Page_ClientValidate()) {
__doPostBack('<%= lnkReportThis.UniqueID %>', '');
}
【问题讨论】:
标签: jquery asp.net validation jquery-ui