I'm trying to access AnonymousTemplate and LoggedInTemplate from UserControl's Code-Behind Page.
Find my UserControl front-end code:<LoggedInTemplate>
Welcome again
<br />
<b><asp:LoginName ID="LoginName1" runat="server"/></b>
<br />
<asp:LoginStatus ID="LoginStatus1" runat="server" LoginText="Login" LogoutText="Logout"/>
<br />
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="/abc/profile">Account Section</asp:HyperLink>
</LoggedInTemplate>
<AnonymousTemplate>
<div style="text-align:center">
<asp:TextBox ID="txtUserName" runat="server" Height="15px" Width="120px"></asp:TextBox>
<br />
<asp:TextBox ID="txtPassword" runat="server" Height="15px" Width="120px" TextMode="Password"></asp:TextBox>
<br />
<asp:Button ID="btnLoginClick" runat="server" Text="Sign In"
onclick="btnLoginClick_Click" />
<br />
<asp:Label ID="lblInvalidMsg" runat="server" Text="" Visible="false"></asp:Label>
</div>
</AnonymousTemplate>
Find my UserControl back-end code (VB, you may reply in c# too):Dim sds As New SqlDataSource()
sds.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString1").ToString()
Dim b As String = txtUserName.Text
Dim c As String = txtPassword.Text
sds.SelectParameters.Add("username", TypeCode.[String], b)
sds.SelectParameters.Add("password", TypeCode.[String], c)
sds.SelectCommand = "SELECT * FROM [users] WHERE [username] = @username AND [password] = @password"
Find my error:Error: txtUserName and txtPassword is not declared.
What I use to access the controls placed under LoginView.