2
Answers

How Session display to a label

Hi, Please help anyone.
I want to display user, like Welcome, (user).

 <div class="header">
                <span class="right">
                    <strong>welcome,
                    <asp:Label ID="agentCode" runat="server" Text='<%# Session["Agent_code"] %>'></asp:Label>
                    </strong>
................................................................................................................................................................
protected void Page_Load(object sender, EventArgs e)
  {
  try
  {
  DataSet dsUser = (DataSet)Session["USER"];
  if (dsUser.Tables[0].Rows.Count > 0)
  {
  agentCode = dsUser.Tables[0].Rows[0]["Agent_code"].ToString();
  userType = dsUser.Tables[0].Rows[0]["User_type"].ToString();
  username = dsUser.Tables[0].Rows[0]["Agent_code"].ToString();
  usermail = dsUser.Tables[0].Rows[0]["Email"].ToString();
  }
  else
  {
  logout();
  }
  }
  catch (Exception ex)
  {
  string err = ex.Message;
  logout();
  }

..Thanks
Answers (2)