|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
101 Question - Passing a value from one page to anotherI'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. 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. >
Other interesting topics
PreInit event in usercontrol
Select string building in C# and ASP.NET Loading UserControl using New Contructor ..HtmlControls.HtmlInputFile.Saveas(filename) not overwriting Application_Error does not fire need help to convert to VB Virtual Directory How do I run a server side method from javascript?! Path conversion self-signed certificate for Windows XP |
|||||||||||||||||||||||