?
Solved

Set label value in LoginView

Posted on 2009-04-22
2
Medium Priority
?
265 Views
Last Modified: 2013-11-07
Hi

I have a loginview control with a LoggedInTemplate. This template has a few lablels controls, but when I try to use them like - me.lblLastloggedIn I get an error.

How do I target these controls. Attached is a section of my login view.

<asp:LoginView ID="LoginView" runat="server">
        
        <LoggedInTemplate>
            <div class="blue">
                    <fieldset>
                        <legend><asp:Image ID="imgStats" runat="server" ImageUrl="~/App_Themes/Expert/Images/Reports_32.png"  Width="32px" Height="32px" CssClass="pageicons"/>Expert Stats</legend>
                        
                        <p>Logged in as:<asp:LoginName ID="LoginName" runat="server" /></p>
                        <p>Available Licences:<asp:Label id="lblLicenses" runat="server"></asp:Label></p>
                        <p>Last Logged in:<asp:Label id="lblLastLoggedIn" runat="server"></asp:Label></p>
 
                    </fieldset>
            </div> 
        
        </LoggedInTemplate>

Open in new window

0
Comment
Question by:Andy Green
2 Comments
 
LVL 12

Accepted Solution

by:
wht1986 earned 2000 total points
ID: 24204049
you can get the reference to a control in a template by using FindControl

Label lbl = (Label)this.LoginView1.FindControl("lblLastLoggedIn");
0
 
LVL 3

Author Closing Comment

by:Andy Green
ID: 31573239
Thank you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month15 days, 19 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question