Results 1 to 4 of 4

Thread: problem with form

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    Macedonia
    Posts
    49

    Exclamation problem with form

    Hi
    My project has two webforms: webform1.aspx and webform2.aspx
    Please tell me how can i get the Text1.text value from webform1.aspx to
    textbox2.text from webform2.aspx. Or if you have any other sugestions
    please write me

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: problem with form

    There are two ways to do it. The first is the QueryString
    In the code that is changing the page put this:
    VB Code:
    1. Response.Redirect("Webform2.aspx?Name=" _
    2. this.txtName.Text + "&LastName=" _
    3. this.txtLastName.Text)

    In the load event of the page your moving to put this
    VB Code:
    1. txtBox1.Text = Request.QueryString["Name"]
    2. txtBox2.Text = Request.QueryString["LastName"]

    The second way is:
    Where the code is that is changing the page.
    VB Code:
    1. session("FName") = txtName.Text
    2. session("LName") = txtLastName.Text

    The load event of the other page
    VB Code:
    1. txtBox1.Text = Session("FName")
    2. txtBox2.Text = Session("LName")

    They both have their advantages, but most of the time the first way is the better way.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: problem with form

    Moved to ASP.NET Forum.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Junior Member
    Join Date
    Aug 2005
    Posts
    24

    Re: problem with form

    Hi,

    You may user Server.Transfer("pagename")

    to move data from one page to another but you have to use the following function code to transefer the form field ..


    Public ReadOnly Property Infant() As Long
    Get
    If TxtInfant.Text <> "" Then
    Return Val(TxtInfant.Text)
    Else
    Return 0
    End If
    End Get
    End Property


    then on movenext page commnad button

    use the following procedure

    Server.Transfer("pagename")



    in the next page load event

    write the following code to get the result

    Dim fp As Previouspage (firstpageclass name)
    If Not IsPostBack Then
    fp = CType(context.Handler, firstpage class name)
    txtCName.Text = fp.Infant()
    ' TxtCno.Text = fp.ConNo()
    'TxtCno.Text = "80"
    ' TxtSTD.Text = fp.cStdate
    ' TxtSEd.Text = fp.ceddate
    ' binddata()
    End If

    This is one of the way ..........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width