T
Terry
Hi,
i want to access control "TextBox1" embedded in another control "LoginView1"
in order to change the 'Text' of the textbox.
Therefore i use 'FindControl' method but i get error:
"Object reference not set to an instance of an object" on line: tb =
lv.FindControl("textbox1")
Thanks for help
Cliff
aspx:
----
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<table>
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<fieldset style="height: 425px; width: 335px;">
<tr><td>
<asp:TextBox ID="TextBox1" runat="server" Text=""></asp:TextBox>
</td></tr>
</fieldset>
</LoggedInTemplate>
</asp:LoginView>
</table>
</asp:Content>
code-behind:
-----------
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim lv As LoginView
Dim tb As TextBox
lv = FindControl("loginview1")
tb = lv.FindControl("textbox1")
tb.Text = "ok"
end sub
i want to access control "TextBox1" embedded in another control "LoginView1"
in order to change the 'Text' of the textbox.
Therefore i use 'FindControl' method but i get error:
"Object reference not set to an instance of an object" on line: tb =
lv.FindControl("textbox1")
Thanks for help
Cliff
aspx:
----
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<table>
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<fieldset style="height: 425px; width: 335px;">
<tr><td>
<asp:TextBox ID="TextBox1" runat="server" Text=""></asp:TextBox>
</td></tr>
</fieldset>
</LoggedInTemplate>
</asp:LoginView>
</table>
</asp:Content>
code-behind:
-----------
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim lv As LoginView
Dim tb As TextBox
lv = FindControl("loginview1")
tb = lv.FindControl("textbox1")
tb.Text = "ok"
end sub