asp.net - Find an asp:Button in VB.NET -
I am trying to codify a code in VB for my website, but VB can not find a button. Is there a way to find the code?
I know where it is. Loginview> Login> Login Template How do I get VB.NET to point to that location?
Since the button is in a template, you will need to use the FindControl method. For example, if you have such a markup:
& lt; Asp: LoginView id = "loginview1" runat = "server" & gt; & Lt; LoggedInTemplate & gt; & Lt; Asp: button id = "btn1" runat = "server" /> & Lt; / LoggedInTemplate & gt; & Lt; / ASP: LoginView & gt;
Then, in your code-back, you have to specify it like this:
button btn = loginview1.FindControl ("btn1") button in the form of; If (BTN! = Null), do whatever you want here