101 Question - Passing a value from one page to another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
One other way would be to pass the value as a querystring parameter to
the next page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top