473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Accessing controls in LoggedInView template

Hello,

I wanted to display a welcome message using the logged-in user's first name
in the <LoggedInTemplate> section of the LoginView. When I attempt to access
my welcome label control in the Page_Load event (where IsPostBack is true) to
populate with the user's first name from the Profiles table, it cannot find
the control. I've seen this question asked in other forums, and have tried
various ways to access the label control such as trying to access it in the
LoginView's ViewChanged event (which only fires in certain cases) to no
avail. What's the best way to attempt to access controls in the
LoggedInTemplate section? Can it be done? Thanks for any help.

-Mike

Mar 7 '06 #1
1 2293
DWS
Mike,
First off with asp.net 2.0 authentication there is the possibility of a
logged in user to hit the page without a postback you replace ispostback with
"NEW" isauthenticated property.

Might be a better method with ITemplate but I don't know it also the logged
in template is not available unless user is logged in.

'findcontrol and ctype to label.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
if page.user.identity.isauthenticated then
Try
'somehow get first name into string or use page.user.identity.name
CType(LoginView1.FindControl("Label1"), Label).Text = firstname
Catch
End Try
endif
End Sub

Good Luck
DWS

"mike2036" wrote:
Hello,

I wanted to display a welcome message using the logged-in user's first name
in the <LoggedInTemplate> section of the LoginView. When I attempt to access
my welcome label control in the Page_Load event (where IsPostBack is true) to
populate with the user's first name from the Profiles table, it cannot find
the control. I've seen this question asked in other forums, and have tried
various ways to access the label control such as trying to access it in the
LoginView's ViewChanged event (which only fires in certain cases) to no
avail. What's the best way to attempt to access controls in the
LoggedInTemplate section? Can it be done? Thanks for any help.

-Mike

Mar 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture...
4
by: Moojjoo | last post by:
Ok fellow C# developers: How do creat an instance of an object inside a dataset or datagrid. Example I need to have a placeholder inside a dataset. Any help would be great.
1
by: Paul Maidment | last post by:
Hi, I am a bit green when it comes to .net development so please excuse me if this question is obvious or has been asked before... I am trying to programmatically access a label control...
2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
4
by: John Holmes | last post by:
I'm using data to rename some web controls on a form that uses a repeater contol and so it can have mulitple instances of the same control set. The controls get renamed (thanks to Steven Cheng's...
15
by: Arpan | last post by:
Consider the following code which retrieves data from a SQL Server 2005 DB table & displays it in a DataGrid: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)...
1
by: Horace Nunley | last post by:
Hi, in my formview "insertItem" template, I have a fileupload control that I need to handle when the page is saved. I can't get to that control, or any of the controls thru code. What gives? ...
3
by: Jeff | last post by:
Hey asp.net 2.0 In the source I posted below, there is a GridView (look at the bottom of the script): <asp:GridView ID="gvwOnline" runat="server"> </asp:GridView> I'm trying to assign a...
1
by: Dave | last post by:
I have the following ASP.NET 2.0 code (simplified here for ease): <asp:Repeater id="SearchResultsRepeater" runat="server"> <ItemTemplate> <uc:SearchResult ID="SearchResult"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.