问题看注释!答案被采用,立即给分!<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:Label ID="lblCheck" runat="server" Text="" Visible="false"></asp:Label>
账户:<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:Button ID="btnCheck" runat="server" OnClick="Even_CheckRole" Text="查询账户" /><br />
</ContentTemplate>
</asp:UpdatePanel>protected void Even_CheckRole(object tmd, EventArgs nnd)
{
if (txtName.Text == "")
return;
//user为实例化的类
if (user= null)
{
ShowMsg(user.Email + "用户存在!");
}
else
{
ShowMsg("用户不存在!");
}
}
//JS显示结果:我不用AJAX控件,就能窗口输出该JS信息,用了就不行
void ShowMsg(string msg)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(), "msg", "alert('" + msg + "');", true);
}
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:Label ID="lblCheck" runat="server" Text="" Visible="false"></asp:Label>
账户:<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:Button ID="btnCheck" runat="server" OnClick="Even_CheckRole" Text="查询账户" /><br />
</ContentTemplate>
</asp:UpdatePanel>protected void Even_CheckRole(object tmd, EventArgs nnd)
{
if (txtName.Text == "")
return;
//user为实例化的类
if (user= null)
{
ShowMsg(user.Email + "用户存在!");
}
else
{
ShowMsg("用户不存在!");
}
}
//JS显示结果:我不用AJAX控件,就能窗口输出该JS信息,用了就不行
void ShowMsg(string msg)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(), "msg", "alert('" + msg + "');", true);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货