当我点击它时如何编码标签或制作逻辑页面注销和会话被清除 [英] How To Code A Label Or Made A Logic When I Click It The Page Logout And The Session Are Cleared

查看:119
本文介绍了当我点击它时如何编码标签或制作逻辑页面注销和会话被清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码用于登录,我希望从这个标签的相同结果作为注销标签chage的文本。但我想点击它们退出并且会话变得清晰。

后端代码

//

protected void Page_Load(object sender,EventArgs e)

{

if(!Page.IsPostBack)

{

if(Session [Name]!= null)

{

lblUserName.Text =U.Name:+ Session [Name]。ToString();

lblUserName.Visible = true;

lblLogin.Text =Logout;

//Label1.Visible = true;

//lblLOgin.Visible = false;

// lblLOgin.Text =LOGOUT;

}

else

{

lblUserName.Text = plz登录;

}



}



}

////

前端代码///



  • < asp:标签ID =lblLoginrunat =serverText =LoginHeight =35pxWidth =50pxVisible =true/>
  • me have the following code its work for login and i want same result from this lable as a logout the text of label chage .but i want to on click they logout and session become clear.
    back end code
    //
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!Page.IsPostBack)
    {
    if (Session["Name"] != null)
    {
    lblUserName.Text = "U.Name:" + Session["Name"].ToString();
    lblUserName.Visible = true;
    lblLogin.Text = "Logout";
    //Label1.Visible = true;
    //lblLOgin.Visible = false;
    // lblLOgin.Text = "LOGOUT";
    }
    else
    {
    lblUserName.Text = "plz login";
    }

    }

    }
    ////
    front end code///


    • <asp:Label ID="lblLogin" runat="server" Text="Login" Height="35px" Width="50px" Visible="true" />
    • 推荐答案

      这篇关于当我点击它时如何编码标签或制作逻辑页面注销和会话被清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆