Home All Groups Group Topic Archive Search About

101 Question - Passing a value from one page to another

Author
22 Dec 2005 8:31 PM
jonefer
I'm using a Public variable that I set on one page so that it will be
available for another page but, I know this isn't the way it should be done.


Being an Access Developer, how would I do the same thing in ASP.NET as:
opening a form and passing a value to OpenArgs so that the next form can
access that value?

Also, for using a selected value from a DataGrid, could someone please show
me the convention (and steps - please?)  for opening a detailed page(1 row) 
using that value that was selected from the dataGrid on another page?  I have
read many examples, but I guess, they are assuming a lot of things that I
should know, because I still can't figure out how to do it - I'm confused
about which event to use - the ChangeSelectedIndex OR the 'Select' button
link... it couldn't be both those events - or could it?

Author
22 Dec 2005 9:07 PM
albert braun
here's a thought for your first question:

Store the value in the Session (a server side var)
protected void Page_Load(object sender, EventArgs e)
{
        string myValue = "some value";
        Session.Add("MyValue", myValue);
}

You can then retrieve the value on the destination page (using e.g.
(string)Session["MyValue"])

A second way would be to use the application Cache, which asks for
additional information, like how long you want the value to remain
cached, etc.
Are all your drivers up to date? click for free checkup

Author
22 Dec 2005 10:14 PM
uttara
One other way would be to pass the value as a querystring parameter to
the next page.

albert braun wrote:
Show quoteHide quote
> here's a thought for your first question:
>
> Store the value in the Session (a server side var)
> protected void Page_Load(object sender, EventArgs e)
> {
>         string myValue = "some value";
>         Session.Add("MyValue", myValue);
> }
>
> You can then retrieve the value on the destination page (using e.g.
> (string)Session["MyValue"])
>
> A second way would be to use the application Cache, which asks for
> additional information, like how long you want the value to remain
> cached, etc.
>

Bookmark and Share