Results 1 to 6 of 6

Thread: How to passing data from one webpage to a new webpages?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    malaysia
    Posts
    89

    Resolved How to passing data from one webpage to a new webpages?

    Hi Guys, i have some difficulties and need your help.

    Let say i have a webpage name "a.aspx" and another name "b.aspx"
    when i click a button in a.aspx and the event will
    response.redirect("b.aspx")
    how can i pass some data that is in a.aspx to b.aspx?
    i.e i want to pass a string variable(name: strA) in a.aspx to b.aspx, how should i code?

    Last edited by kkc; Dec 12th, 2004 at 10:22 PM.

  2. #2
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    You could pass it along as a QueryString variable? Or a session variable if you don't want the user to see it. Personally, I'd go with the QueryString
    Code:
    Response.Redirect('b.aspx?strA=My%20String');

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    malaysia
    Posts
    89

    Question Re: How to passing data from one webpage to a new webpages?

    how do pass as a session variable?
    because i dont want to let a user to see it

  4. #4
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345

    Re: How to passing data from one webpage to a new webpages?

    In your first page, use something like
    Code:
    Session['strA'] = "My String";
    Response.Redirect('b.aspx');
    In b.aspx:
    Code:
    string strA = (string) Session['strA'];
    This is assuming that you're writing in C#. For VB.NET the syntax is *slightly* different.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    malaysia
    Posts
    89

    Re: How to passing data from one webpage to a new webpages?

    if i want to pass session variable of strA to b.apsx textbox control(i.e, textbox name: txtStrA)
    how to pass ?
    can give sample code in vb.net?

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to passing data from one webpage to a new webpages?

    Code:
    txtStrA.Text = Session("username").ToString()
    I suggest a basic vb.net/asp.net tutorial first...

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