ASP.NET 2.0 LoginView & TextBox...

sidnijs

Newcomer
Joined
Jul 26, 2006
Messages
7
:confused:
I have script and this script have to get information from textbox which is in a LoginView!

Code:
<script language="vb" runat="server">
....
............. = TextBox1.Text
....

</script>
<html.... 
....
   <asp:LoginView ID="LoginView1" runat="server">
      <AnonymousTemplate>
         <asp:TextBox ID="TextBox1" runat="server" Width="305px"></asp:TextBox>
      </AnonymousTemplate>
   </asp:LoginView>

</html>

But there is an error whet I run my page...
:(
"TextBox1 not declared" <--- error in script!

[size=8+]WHY?????[/size]

I have tried to write "LoginView1.TextBox1.Text", "LoginView1.AnonymousTemplate.TextBox1.Text" and others... :(

:confused:
 
You will need to use the FindControl method of the LoginView control - something like
C#:
 ((TextBox)LoginView1.FindControl("TextBox1")).Text = "Test";
although you need to be aware that if the user is logged in this will return null.
 
=/ I still have a problem.

Code:
LoginView1.FindControl(textbox1).Text

The name 'textbox1' is not declared!

=/

i don't understand!!!! :confused:

p.S. Textbox is in ''AnonymousTemplate'' ---> and i'm not logged in...
 
Code:
ctype (loginview1.findcontrol("Textbox1"), textbox).text

^--- sometimes works!!!!



I hate MS programmers!!! :mad:
 
Back
Top