您的位置:首页 > 其它

panel的visible属性影响页面布局

2012-10-31 23:17 387 查看
1、例程

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Panel1.Visible = true;
Panel2.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "mr" & TextBox2.Text == "mrsoft")
{
Session["UserName"] = TextBox1.Text.Trim();
Panel1.Visible = false;
Panel2.Visible = true;
Label1.Text = DateTime.Now.ToLongDateString();
Label2.Text = "欢迎 " + Session["UserName"].ToString() + " 登录!";
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Session["UserName"]=string.Empty;
Response.Redirect(Request.CurrentExecutionFilePath);
}
}


说明panel在设置visible=false后,其在web页面中的位置和空间也释放了,此法常用语同一个web页面中

相同位置显示不同模块化的信息
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: