[Mono-bugs] [Bug 81344][Nor] New - LoginView.FindControl does not find control in LoggedInTemplate

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Apr 10 01:02:50 EDT 2007

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mmorano at mikeandwan.us.


--- shadow/81344	2007-04-10 01:02:50.000000000 -0400
+++ shadow/81344.tmp.29494	2007-04-10 01:02:50.000000000 -0400
@@ -0,0 +1,44 @@
+Bug#: 81344
+Product: Mono: Class Libraries
+Version: 1.2
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: Sys.Web
+AssignedTo: mhabersack at novell.com                            
+ReportedBy: mmorano at mikeandwan.us               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: LoginView.FindControl does not find control in LoggedInTemplate
+I have a LoginView declared on a page, and need to access a control in the
+LoggedInTemplate.  However, when I try to obtain a reference to the
+control, it is not found.  The following is a simplified version of how
+this is declared in the page:
+<asp:LoginView ID="loginView" runat="server">
+    <AnonymousTemplate>
+   	<asp:Login ID="login" runat="server">
+     	    ...
+        </asp:Login>
+    </AnonymousTemplate>
+    <LoggedInTemplate>
+	Welcome back <asp:Literal ID="nameLiteral" runat="server" />.
+    </LoggedInTemplate>
+Then in the codebehind, it tries to find the literal control, so it can set
+text appropriately.  However, the following code always results in a null
+reference, rather than a reference to the Literal:
+Literal nameLiteral = loginView.FindControl("nameLiteral") as Literal;
+nameLiteral.Text = "Bob";
+This code is working on MS, but currently not on mono (r75493).

More information about the mono-bugs mailing list