if语句在母版页中 [英] if statement in master page
本文介绍了if语句在母版页中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在母版页中创建if语句,以便它可以打开一个页面。
Hi,
I am trying to make if statement in the master page so that it can open a page.
protected void Button1_Click(object sender, EventArgs e)
{
if
{
Response.Redirect("login.aspx");
}
else
{
Response.Redirect("Default.aspx");
}
}
如果按钮文本显示登录我需要转到默认值。 aspx如果它读取注销然后我需要去login.aspx
谢谢,
if the button text reads login i need to go to default.aspx and if it reads logout then i need to go to login.aspx
thanks,
推荐答案
尝试
Try
Button b = (Button) sender;
if (b.Text == "login")
{
Response.Redirect("login.aspx");
}
else
{
Response.Redirect("Default.aspx");
}
这篇关于if语句在母版页中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文