Link to home
Start Free TrialLog in
Avatar of jknj72
jknj72

asked on

Master page login label

I have a Master page and on it is the user that is logged into the app. I am having trouble assigning a value to this label to the current user. I have a login page that when the user logs in the label on the Master should be updated. I have the label in an Update Panel to refresh everytime the user logs in but it still doesnt take the logged in users value. I have assign a property that I can set the value with from another page  but that isnt working for me? This is the code in the master

    Public Property PageLabel() As String
        Get
            Return lblUser.Text
        End Get
        Set(value As String)
            lblUser.Text = value
            upUserLabel.Update()
        End Set
    End Property

Open in new window

And in my Login page I assign the username after I check the DB with this
Session("LoginLabel") = Session("UserRole") & " \ " & Session("UserName")
 Me.Master.PageLabel = Session("LoginLabel")

Open in new window

I have added this in the Login pages markup
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/ItemMaster.Master" CodeBehind="UserLogin.aspx.vb" Inherits="CRIB_EAST.UserLogin" %>
<%@ MasterType VirtualPath="~/ItemMaster.Master" %>

Open in new window


I know Im screwing up somewhere but I just do not know where.
Any help would be appreciated

Thanks
JK
Avatar of jknj72
jknj72

ASKER

Just an FYI, this is the label and a link that I have on my Master page that I am trying to update. I dont know if this will help but I want to include it just in case

 <div style="float:right;padding-right:50px;">
                <asp:UpdatePanel ID="upUserLabel" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Label ID="lblUser" runat="server" ForeColor="White" Width="260px" Font-Bold="true" style="margin-right: 20px;text-align:right;" Visible="true" ></asp:Label>
                        &nbsp;&nbsp;         
                        <asp:LinkButton ID="lnkSignOut" runat="server" Text="Sign Out" ForeColor="White" PostBackUrl="~/UserLogin.aspx" OnClick="lnkSignOut_Click" ></asp:LinkButton>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Joe Fulginiti
Joe Fulginiti

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jknj72

ASKER

I was told back when I first put this code in that using the property Get and Set and <%@ MasterType VirtualPath="~/ItemMaster.Master" %>  in the page I was setting from(Login page) that I could manipulate the label. When I hit the code
Me.Master.PageLabel = Session("LoginLabel")
It goes to the Master and sets the labels proprty it just doesnt show the value? Hope this makes sense
Avatar of jknj72

ASKER

put in the page load of master and page load of UserLogin page. Thanks for the help!