最近在看传智播客的.Net培训视频教程,13季的视频全都免费下载下来了。
遇到了ispostback的问题
麻烦知道的给下
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//
Panel1.Visible = true;
PaneWelcome.Visible = false;
}
else
{
string userName = Session["UserName"].ToString();
if (userName == "")
{
Panel1.Visible = true;
PaneWelcome.Visible = false;
}
else
{
PaneWelcome.Visible = true;
Panel1.Visible = false;
lblWelcomeMsg.Text = "尊敬的" + userName + "您好";
}
}
}
——————————index.aspx—————————————————————
<form id="form1" runat="server" action="login.ashx">
<div id="login1main">
<asp:Panel ID="Panel1" runat="server" Visible="false">
<ul>
<li>
<input type="submit" value="登录" />
<a href="Register.aspx">
<img alt="" src="images/icon_zc1.gif" border="0" /></a></li>
</ul>
</asp:Panel>
<asp:Panel ID="PaneWelcome" runat="server" Visible="false">
<ul>
<li>
<asp:Label ID="lblWelcomeMsg" runat="server" Text=""></asp:Label></li>
<li><a href="#" class="xg">资料密码修改</a></li>
<li><a href="#" class="jyjl">交易记录查询</a></li>
<li><a href="#" class="exit">退出一卡通平台</a></li>
</ul>
</asp:Panel>
</div>
</form>
_____________________________________提交到login.ashx
if (pwd == dbPassword)
{
//登陆成功转向
context.Session["UserName"] = userName;
context.Response.Redirect("~/index.aspx");
}
我是想通过index.aspx中的panel来显示登录 则显示欢迎XX 没有panel则换成登录窗口 但是load的ispostback一直是false
请问是什么问题??