473,671 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding Controls in LoginView removes references

When I put asp controls inside the LoginView it removes the codebehind
references so that the page will not build. For example:
<asp:LoginVie w ID="LoginView" runat="server" >
<LoggedInTempla te>
<asp:LoginNam e id="loginName" runat="server" FormatString="Y ou
are logged in as: {0} | " />
<asp:LoginStatu s id="loginStatus " runat="server"
LogoutText="log off" />
<br />
<asp:Label ID="pageContent IsAuth" runat="server" >
Proceed to <a href="/members/">members section</a<br />
</asp:Label>
</LoggedInTemplat e>
</asp:LoginView>

The LoginName, loginStatus, pageContentIsAu th control references in code
behind pagename.aspx.d esigner.vb are removed, but if copy them outside of the
control such as:
<asp:LoginVie w ID="LoginView" runat="server" >
<LoggedInTempla te>
Removed Controls
</LoggedInTemplat e>
</asp:LoginView>
<asp:LoginNam e id="loginName" runat="server" FormatString="Y ou are logged in
as: {0} | " />
<asp:LoginStatu s id="loginStatus " runat="server" LogoutText="log off" />

<br />
<asp:Label ID="pageContent IsAuth" runat="server" >
Proceed to <a href="/members/">members section</a<br />
</asp:Label>

then the controls are added back to pagename.aspx.d esigner.vb and the page
is able to compile. I've read that you can embed controls with the LoginView
control. Is this true? If so, what do I need to do work around this issue?
Dec 23 '06 #1
3 4407
You should be able to access the controls in code-behind like
LoginView.FindC ontrol("loginNa me") etc.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"jmhmaine" <jm*@online.nos pamwrote in message
news:EA******** *************** ***********@mic rosoft.com...
When I put asp controls inside the LoginView it removes the codebehind
references so that the page will not build. For example:
<asp:LoginVie w ID="LoginView" runat="server" >
<LoggedInTempla te>
<asp:LoginNam e id="loginName" runat="server" FormatString="Y ou
are logged in as: {0} | " />
<asp:LoginStatu s id="loginStatus " runat="server"
LogoutText="log off" />
<br />
<asp:Label ID="pageContent IsAuth" runat="server" >
Proceed to <a href="/members/">members section</a<br />
</asp:Label>
</LoggedInTemplat e>
</asp:LoginView>

The LoginName, loginStatus, pageContentIsAu th control references in code
behind pagename.aspx.d esigner.vb are removed, but if copy them outside of
the
control such as:
<asp:LoginVie w ID="LoginView" runat="server" >
<LoggedInTempla te>
Removed Controls
</LoggedInTemplat e>
</asp:LoginView>
<asp:LoginNam e id="loginName" runat="server" FormatString="Y ou are logged
in
as: {0} | " />
<asp:LoginStatu s id="loginStatus " runat="server" LogoutText="log off" />

<br />
<asp:Label ID="pageContent IsAuth" runat="server" >
Proceed to <a href="/members/">members section</a<br />
</asp:Label>

then the controls are added back to pagename.aspx.d esigner.vb and the page
is able to compile. I've read that you can embed controls with the
LoginView
control. Is this true? If so, what do I need to do work around this issue?

Dec 23 '06 #2
That appears to be late bound code, do you have an example of early bound
code? I would prefer early bound code for performance reasons and I would
like to take advantage of Intellisence when referencing the object in code.
Thanks.

Josh.

"Eliyahu Goldin" wrote:
You should be able to access the controls in code-behind like
LoginView.FindC ontrol("loginNa me") etc.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"jmhmaine" <jm*@online.nos pamwrote in message
news:EA******** *************** ***********@mic rosoft.com...
When I put asp controls inside the LoginView it removes the codebehind
references so that the page will not build. For example:
<asp:LoginVie w ID="LoginView" runat="server" >
<LoggedInTempla te>
<asp:LoginNam e id="loginName" runat="server" FormatString="Y ou
are logged in as: {0} | " />
<asp:LoginStatu s id="loginStatus " runat="server"
LogoutText="log off" />
<br />
<asp:Label ID="pageContent IsAuth" runat="server" >
Proceed to <a href="/members/">members section</a<br />
</asp:Label>
</LoggedInTemplat e>
</asp:LoginView>

The LoginName, loginStatus, pageContentIsAu th control references in code
behind pagename.aspx.d esigner.vb are removed, but if copy them outside of
the
control such as:
<asp:LoginVie w ID="LoginView" runat="server" >
<LoggedInTempla te>
Removed Controls
</LoggedInTemplat e>
</asp:LoginView>
<asp:LoginNam e id="loginName" runat="server" FormatString="Y ou are logged
in
as: {0} | " />
<asp:LoginStatu s id="loginStatus " runat="server" LogoutText="log off" />

<br />
<asp:Label ID="pageContent IsAuth" runat="server" >
Proceed to <a href="/members/">members section</a<br />
</asp:Label>

then the controls are added back to pagename.aspx.d esigner.vb and the page
is able to compile. I've read that you can embed controls with the
LoginView
control. Is this true? If so, what do I need to do work around this issue?


Dec 24 '06 #3
On Sun, 24 Dec 2006 04:43:01 -0800, jmhmaine wrote:
That appears to be late bound code, do you have an example of early bound
code? I would prefer early bound code for performance reasons and I would
like to take advantage of Intellisence when referencing the object in code.
Thanks.
You can't do early bound code in login controls (or many other kinds).
Dec 27 '06 #4

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

Similar topics

0
1043
by: RedEye | last post by:
Hello, I have been looking for a way to add roles to a LoginView control programmatically and it's not working. I have called the sub at init and load and neither work. Does anyone know what I may be over looking? Thanks for any help Private Sub AddRoles() Dim rg As New RoleGroup
2
5831
by: LLars | last post by:
Hey, I have the following problem: I have an asp-page which contains a loginview with two templates (loggedin- and anonymoustemplate). How can I access a textbox inside the the loggedintemplate from the code behind c# module? I tried: (TextBox)Page.FindControl("TextBox1") but that will result in a null pointer. I also tried: (TextBox)Page.FindControl("ContentPlaceHolder1.LoginView1.TextBox1") with the
1
2302
by: mike2036 | last post by:
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...
3
3773
by: dmm | last post by:
Hi all, I am using master pages and am having a bit of an issue. As part of my masterpage I want to display the user's current logged in status using the LoginView. However I get the following error: Control 'loginView' of type 'LoginView' must be placed inside a form tag with runat=server. I can see that the LoginView is indeed being rendered outside the form tag - which seems to surround the content placeholder - so I understand the...
1
6428
by: pj | last post by:
I'm trying to redirect users to another page after they Authenticate with the ASP.NET login controls. The user is able to login, but I can't get the response.redirect to work. Can anyone help? My code is below. Thanks, pj mcdba, mcp
2
1229
by: Seb | last post by:
With in my login view I have some labels and a button with a onclick event. However when I click the button I can only access my controls by declaring a new control and using the FindControl method of my loginview as shown below. Is this really the best way to do it? Label Label1 = (Label)LoginView1.FindControl("Label1");
4
3006
by: Ken Fine | last post by:
I'm making an administrative interface that lists records in a GridView. For *each* row in the gridview, I would there to be two interface elements in addition to some information associated with the record. Those interface elements are a Button and a TextBox. The idea is that the administrator using the interface will fill in an e-mail address and press the button if they want to send that particular record to someone by e-mail. (I know...
32
2775
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put some new ones on. In my code I am doing the following: For Each ctrl In tpMain.Controls If TypeOf (ctrl) Is CheckBox Then If ctrl.Name.StartsWith("chkS") Then ctrl.Visible = False
2
1586
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm about to start programming a new website at work. My boss want's me avoid using the Membership system in ASP.NET 2.0 (probably because he don't understand how it works...)... Well the users will be devided into 2 categories. Normal user and Administrators
0
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7445
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6237
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.