|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
problem with FindControli 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 If you are running this on the content page, you don't need tom FindControl
the LoginView. You can just Dim tb As TextBox tb = Me.LoginView1.FindControl("textbox1") tb.Text = "ok" Show quoteHide quote "Terry" <n*@mail.pr> wrote in message news:eUnDZyNUHHA.4668@TK2MSFTNGP04.phx.gbl... > 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 > > > Thanks, it works indeed ...
Maybe you can also help me with the other problem in the thread above "how to trigger .."? Show quoteHide quote "Teemu Keiski" <jot***@aspalliance.com> schreef in bericht news:F71CEBC9-B5A2-4BFA-819C-A88BB87BE5EA@microsoft.com... > If you are running this on the content page, you don't need tom > FindControl the LoginView. You can just > > Dim tb As TextBox > tb = Me.LoginView1.FindControl("textbox1") > tb.Text = "ok" > > -- > Teemu Keiski > AspInsider, ASP.NET MVP > http://blogs.aspadvice.com/joteke > http://teemukeiski.net > > > > > > "Terry" <n*@mail.pr> wrote in message > news:eUnDZyNUHHA.4668@TK2MSFTNGP04.phx.gbl... >> 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 >> >> >> >
AJAX and embeded controls
menu navigation control and CSS interference how to change email defined when creating account? GridView Header Height ControlToValidate Script manager equivalent... How can I do? why is this html table still visible? Put the date of today in a text control How can I select a row by clicking on ANY column Datagrid HeaderStyle.CssClass applied to <tr> |
|||||||||||||||||||||||