帮忙看看asp.net代码哪错了,无法退出系统
前台代码<tdalign="center"><spanclass="x"><fontcolor="#FF3300"><asp:LinkButtonID="LinkButt...
前台代码
<td align="center">
<span class="x">
<font color="#FF3300">
<asp:LinkButton ID="LinkButton1" runat="server" Text="退出系统"
onclick="LinkButton1_Click">
</asp:LinkButton>
</font>
</span>
</td>
后台代码
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class user_left : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string userName = Convert.ToString(Session["userName"]);
//=Convert.ToString(Session["qx"]);
if (userName == "")
{
Response.Redirect("index.aspx");
}
if (!IsPostBack)
{
Maticsoft.BLL.gsclass bll = new Maticsoft.BLL.gsclass();
DataSet ds = bll.GetList("classid=29");
this.Repeater1.DataSource = ds.Tables[0].DefaultView;
this.Repeater1.DataBind();
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
}
这样还是提示还缺个括号 )
protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Request.Cookies.Clear();
Session.Clear();
Response.Write("<script>alert('退出成功!');top.window.location.href="default.aspx"</script>")
}
} 展开
<td align="center">
<span class="x">
<font color="#FF3300">
<asp:LinkButton ID="LinkButton1" runat="server" Text="退出系统"
onclick="LinkButton1_Click">
</asp:LinkButton>
</font>
</span>
</td>
后台代码
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class user_left : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string userName = Convert.ToString(Session["userName"]);
//=Convert.ToString(Session["qx"]);
if (userName == "")
{
Response.Redirect("index.aspx");
}
if (!IsPostBack)
{
Maticsoft.BLL.gsclass bll = new Maticsoft.BLL.gsclass();
DataSet ds = bll.GetList("classid=29");
this.Repeater1.DataSource = ds.Tables[0].DefaultView;
this.Repeater1.DataBind();
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
}
这样还是提示还缺个括号 )
protected void LinkButton1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Request.Cookies.Clear();
Session.Clear();
Response.Write("<script>alert('退出成功!');top.window.location.href="default.aspx"</script>")
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询