Embedding Controls in LoginView removes references

G

Guest

When I put asp controls inside the LoginView it removes the codebehind
references so that the page will not build. For example:
<asp:LoginView ID="LoginView" runat="server" >
<LoggedInTemplate>
<asp:LoginName id="loginName" runat="server" FormatString="You
are logged in as: {0} | " />
<asp:LoginStatus id="loginStatus" runat="server"
LogoutText="logoff" />
<br />
<asp:Label ID="pageContentIsAuth" runat="server" >
Proceed to <a href="/members/">members section</a> <br />
</asp:Label>
</LoggedInTemplate>
</asp:LoginView>

The LoginName, loginStatus, pageContentIsAuth control references in code
behind pagename.aspx.designer.vb are removed, but if copy them outside of the
control such as:
<asp:LoginView ID="LoginView" runat="server" >
<LoggedInTemplate>
Removed Controls
</LoggedInTemplate>
</asp:LoginView>
<asp:LoginName id="loginName" runat="server" FormatString="You are logged in
as: {0} | " />
<asp:LoginStatus id="loginStatus" runat="server" LogoutText="logoff" />

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

then the controls are added back to pagename.aspx.designer.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?
 
E

Eliyahu Goldin

You should be able to access the controls in code-behind like
LoginView.FindControl("loginName") etc.
 
G

Guest

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 said:
You should be able to access the controls in code-behind like
LoginView.FindControl("loginName") etc.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


jmhmaine said:
When I put asp controls inside the LoginView it removes the codebehind
references so that the page will not build. For example:
<asp:LoginView ID="LoginView" runat="server" >
<LoggedInTemplate>
<asp:LoginName id="loginName" runat="server" FormatString="You
are logged in as: {0} | " />
<asp:LoginStatus id="loginStatus" runat="server"
LogoutText="logoff" />
<br />
<asp:Label ID="pageContentIsAuth" runat="server" >
Proceed to <a href="/members/">members section</a> <br />
</asp:Label>
</LoggedInTemplate>
</asp:LoginView>

The LoginName, loginStatus, pageContentIsAuth control references in code
behind pagename.aspx.designer.vb are removed, but if copy them outside of the
control such as:
<asp:LoginView ID="LoginView" runat="server" >
<LoggedInTemplate>
Removed Controls
</LoggedInTemplate>
</asp:LoginView>
<asp:LoginName id="loginName" runat="server" FormatString="You are logged in
as: {0} | " />
<asp:LoginStatus id="loginStatus" runat="server" LogoutText="logoff" />

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

then the controls are added back to pagename.aspx.designer.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?
 
E

Erik Funkenbusch

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top