Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Passing Parameters in ASP.NET
Author:
Gigasoft
Website:
http://www.gigasoft.com
Submitted:
7/23/2004
Version:
ASP.NET 1.0
Compatibility:
ASP.NET 1.0
Category:
ASP.NET
Views:
75832
I'm frequently asked how to pass parameters from one page to another page in ASP.NET. This is a beginner's question and every ASP.NET developer should master this concept. So if you don't already know the answer, then definitely read on... I get asked this alot as our charting tool is implemented via two web pages. One web page has a server chart control that renders as HTML (either an IMG or CLSID object tag.) The second page has a server control that streams the bits constituting the object created via HTML from the first page. This process is ideal for web-farm environments as it's purely scaleable. To help visualize the problem. Take a look at www.gigasoft.com/financial.aspx On the left hand side of chart the user can select a stock symbol to load the corresponding stock data. To implement such a site...
Declarations:
'none
Code:
'Within the Page_Load for the form1 (Financial.aspx.cs) // Add a parameter to pass volume checkbox data string s = ""; if (VolumeCheckbox.Checked == true) s = s + "Volume=1"; else s = s + "Volume=0"; // Add a parameter to pass symbol combobox data s = s + "&Symbol=" + SymbolComboBox.Value.ToString(); PegoWeb1.ImageUrl = "Financial2.aspx?" + s; Within the Page_Load of the form2. string sVolume; string sSymbol; sVolume = this.Request.QueryString.Get("Volume"); sSymbol = this.Request.QueryString.Get("Symbol"); Note the "?" at end of ImageUrl = "Financial2.aspx?". Note you can string together multiple parameters separating with "&" symbol.
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement