Don't tell me no one knows the answer 
Author Message
 Don't tell me no one knows the answer

I am creating a textbox on the fly.  I can't get the data out before it
posts.  HELP!!!

The following is code from a web form that was created to show the problem.
The problem is that the textbox (TextBox1) that was placed on the form
explicitly persists.  The other textbox (TextBox2), the one that created on
the fly, does not persist from one load of the page to the next.  How can I
get either:

1.  TextBox2 to persist, or

2.  Bbe able to access the value from the page just before going to the
next instance of the page, in which the former instance of TextBox2 is
entirely lost, but I don't care because I have the value of the contents.

tlp

Public Class Test

    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.

    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init

        'CODEGEN: This method call is required by the Web Form Designer

        'Do not modify it using the code editor.

        InitializeComponent()

    End Sub

    Protected WithEvents Button1 As System.Web.UI.WebControls.Button

    Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

    Protected WithEvents Panel1 As System.Web.UI.WebControls.Panel

#End Region

    Dim TextBox2 As System.Web.UI.WebControls.TextBox

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

        If Not Page.IsPostBack Then

            TextBox2 = New System.Web.UI.WebControls.TextBox()

            TextBox2.Text = "Before"

            Panel1.Controls.Add(TextBox2)

        End If

    End Sub

End Class



Fri, 15 Jul 2005 12:09:20 GMT  
 Don't tell me no one knows the answer
Why not place the data in a session variable, or store the object itself in
session?

or what is the mechanism the user is using to get to the next page?  A link,
a form post, or ???

If it is a form post, make that text box part of the form and post the data.

Scott Emick


Quote:
> I am creating a textbox on the fly.  I can't get the data out before it
> posts.  HELP!!!

> The following is code from a web form that was created to show the
problem.
> The problem is that the textbox (TextBox1) that was placed on the form
> explicitly persists.  The other textbox (TextBox2), the one that created
on
> the fly, does not persist from one load of the page to the next.  How can
I
> get either:

> 1.  TextBox2 to persist, or

> 2.  Bbe able to access the value from the page just before going to the
> next instance of the page, in which the former instance of TextBox2 is
> entirely lost, but I don't care because I have the value of the contents.

> tlp

> Public Class Test

>     Inherits System.Web.UI.Page

> #Region " Web Form Designer Generated Code "

>     'This call is required by the Web Form Designer.

>     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> InitializeComponent()

>     End Sub

>     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Init

>         'CODEGEN: This method call is required by the Web Form Designer

>         'Do not modify it using the code editor.

>         InitializeComponent()

>     End Sub

>     Protected WithEvents Button1 As System.Web.UI.WebControls.Button

>     Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

>     Protected WithEvents Panel1 As System.Web.UI.WebControls.Panel

> #End Region

>     Dim TextBox2 As System.Web.UI.WebControls.TextBox

>     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load

>         If Not Page.IsPostBack Then

>             TextBox2 = New System.Web.UI.WebControls.TextBox()

>             TextBox2.Text = "Before"

>             Panel1.Controls.Add(TextBox2)

>         End If

>     End Sub

> End Class



Fri, 15 Jul 2005 13:37:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Hmm, Don't know this one.

2. Help-don't know what i'm missing

3. Don't know if i'm in the right newsgroup

4. Don't need code, just answers

5. NO ONE knows the answer!

6. Please don't answer messages that have been cross posted

7. Please don't answer messages that have been cross posted

8. Seems that no one knows the answer !!!

9. I guess no one knows the answer!!!!!

10. What You Always Wanted to Know about CR, but Seagate Didn't Tell You

11. Don't Know How to Publicly Declare Variable

12. Microsoft Windows 95 don't know calculation

 

 
Powered by phpBB® Forum Software