--------------aspx--------------------
function showmsg(ctl,args)
{
if(confirm(document.add.txt_title.value))
{
args.isvalid=true;
}
else
{
args.isvalid=false;
}
}
.................
<asp:textbox id="txt_title" runat="server" cssclass="stedit" width="240"></asp:textbox>
<asp:textbox id="txt_hidden" runat="server" cssclass="stedit" width="0" readonly="true"></asp:textbox>
..................
<asp:customvalidator id="customvalidator2" runat="server" onservervalidate="val2" clientvalidationfunction="showmsg" controltovalidate="txt_hidden" display="dynamic"></asp:customvalidator>
--------------------cs----------------------
...................
public void val2(object sender, servervalidateeventargs e)
{
e.isvalid=true;
}
...................
private void page_load(object sender, system.eventargs e)
{
...................
if(!page.ispostback)
{
txt_hidden.text="init hidden textbox";
...................
}
}
新闻热点
疑难解答