我的Project里用到了一个ModalPopupExtender,我用了一个TextBox,然后写了个TextChanged事件,用来异步查询是否有这个用户,这个TextBox是在ModalPopupExtender里面的,当我TextChanged的时候它就会出发PostBack,从而导致弹出窗口关闭,我不希望此时关闭弹出窗口,该如何做?前台代码:(缩略) <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px" style="display:none">
<table align="center" cellpadding="4" cellspacing="1" class="tableborder" style="width: 580px; height: 433px">
<tr>
<td style="width: 119px; height: 32px" class="altbg1">
用户登陆名:</td>
<td style="width: 690px; height: 32px" class="altbg2">
<asp:TextBox ID="TxtUser" runat="server" AutoPostBack="True" OnTextChanged="TxtUser_TextChanged1"></asp:TextBox></asp:Panel>
</table>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="LinkButton2" PopupControlID="Panel1" BackgroundCssClass="bgcss" CancelControlID="Button1" Drag="true" PopupDragHandleControlID="table1" X="365" Y="75">
</cc1:ModalPopupExtender>
后台代码:
protected void TxtUser_TextChanged1(object sender, EventArgs e)
{
int rs = B2CBll.UserInfoManager.SelectUserInfoByLoginName(this.TxtUser.Text);
if (rs > 0)
{
this.Label2.Text = "该用户名已被注册!";
}
else
{
this.Label2.Text = "";
}
}拜托各位大虾了!
<table align="center" cellpadding="4" cellspacing="1" class="tableborder" style="width: 580px; height: 433px">
<tr>
<td style="width: 119px; height: 32px" class="altbg1">
用户登陆名:</td>
<td style="width: 690px; height: 32px" class="altbg2">
<asp:TextBox ID="TxtUser" runat="server" AutoPostBack="True" OnTextChanged="TxtUser_TextChanged1"></asp:TextBox></asp:Panel>
</table>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="LinkButton2" PopupControlID="Panel1" BackgroundCssClass="bgcss" CancelControlID="Button1" Drag="true" PopupDragHandleControlID="table1" X="365" Y="75">
</cc1:ModalPopupExtender>
后台代码:
protected void TxtUser_TextChanged1(object sender, EventArgs e)
{
int rs = B2CBll.UserInfoManager.SelectUserInfoByLoginName(this.TxtUser.Text);
if (rs > 0)
{
this.Label2.Text = "该用户名已被注册!";
}
else
{
this.Label2.Text = "";
}
}拜托各位大虾了!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货