Results 1 to 8 of 8

Thread: Posting Data between different web forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70

    Posting Data between different web forms

    I'm trying to pass data from one aspx page to another using a form.

    I want to recieving page to have access to this data either through something similar to the traditional request.form metod or by some other way, I would like to be able to enumerate through the values as well but this is a nice to have. I'm also using c# although vb.net examples are just as welcome.

    Anybody got any advice.

    Cheers

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    what is wrong with request.form?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70
    Request.Form won't work because I'm not submitting a form to a a new page, I'm calling an event on my first page, from which I then want to transfer the data. I've tried using the Server.Transfer method and this works fine, but I really need to be able to enumerate through the Request.Form collection (or any collection) and can't seem to get this bit.

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Can you use a query string? If you can, you can use Request.QueryString() method to retrieve a NameValue collection. You can then refer to individual values by name, and I think since it is a collection, you can probably enumerate through them.

    You can find the NameValue collection object in the System.Collections.Specialized

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70
    That's definately an option, but I'm sure there must be a way to transfer the entire form so that it can be referenced. I'll keep trying.

  6. #6
    New Member
    Join Date
    Mar 2003
    Posts
    9
    Try the Server objects Transfer method.
    Brad

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    well. Request.Form is also a collection so you should be able to iterate through it as well. Problem is, when you set the 2nd parameter of Server.Transfer to True in order to persist the Request values to the new page, it give an error about invalid Viewstate.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70
    Yes the server.transfer method was so full of promise if not for that problem with viewstate. My solution to this is just to use bog standard HTML controls on the search criteria form, which is probably more efficient in terms of server resources anyway, although I've got to admit a bit disappointing because I wanted to keep the structure of my application consistent. I can access values of individual controls on the sending page, I just can't iterate through them using foreach even when I set the public property of the sending page as a collection and return this (c# equivalent to me). If anyone ever stumbles across an answer to this I would be delighted to here about it.
    Cheers,

    Nick

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