SolutionCottage.com
Posted  13 Nov 2008 - 21:19:13

Category: ASP.net


Access controls in a LoginView

Issue:
You can not directly access controls that are in a LoginView control.

Solution:
You can use FindControl to access them, here is some example code:

ASP:

<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<asp:Label runat="server" ID="LabelYouWant" />
[...]


Codebehind:

Label LabelYouWant = (Label)LoginView1.FindControl("LabelYouWant");
if (LabelYouWant != null)
LabelYouWant.Text = "I can access the Label!";








0 comments:








© SolutionCottage 2008-2011 9/26/2017 10:07:16 AM