473,569 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing and using parameters

Passing and using parameters

How to get hold of the parameter value provided by the URL? When I open a
web form with a DataSource I often include a parameter in the URL as below:

myNewPage.aspx? myParam = 10

If I simply need to use the value of myParam in the VB code when the new
page load, how do I refer to the parameter?

e.g. myLabel.Text = myParam (where myParam is replaced with a proper way to
refer to it)

TIRislaa
Dec 14 '06 #1
3 1537
It comes from the Request.QuerySt ring collection. I forget the VB code, but
in C# it's:

Request.QuerySt ring["myParam"].ToString()

Keep in mind, before you ever attempt to reference it, you'll need to make
sure that it is not a null value. If you don't test for null first, and the
querystring variable isn't present (it could be there but misspelled for
example) then it will through a null reference error when you attempt to use
the ToString() method on it. Always test for null first just in case.

in C# the test woud be:

if(Request.Quer yString["myParam"] != null)
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Tor Inge Rislaa" <to************ @rislaa.nowrote in message
news:uB******** ******@TK2MSFTN GP06.phx.gbl...
Passing and using parameters

How to get hold of the parameter value provided by the URL? When I open a
web form with a DataSource I often include a parameter in the URL as
below:

myNewPage.aspx? myParam = 10

If I simply need to use the value of myParam in the VB code when the new
page load, how do I refer to the parameter?

e.g. myLabel.Text = myParam (where myParam is replaced with a proper way
to refer to it)

TIRislaa


Dec 14 '06 #2
myLabel.Text = Request.QuerySt ring("myParam")

or

Request.QuerySt ring.GetValues( "myParam")[1] if you have more than one named
myParam value

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Tor Inge Rislaa" <to************ @rislaa.nowrote in message
news:uB******** ******@TK2MSFTN GP06.phx.gbl...
Passing and using parameters

How to get hold of the parameter value provided by the URL? When I open a
web form with a DataSource I often include a parameter in the URL as
below:

myNewPage.aspx? myParam = 10

If I simply need to use the value of myParam in the VB code when the new
page load, how do I refer to the parameter?

e.g. myLabel.Text = myParam (where myParam is replaced with a proper way
to refer to it)

TIRislaa


Dec 14 '06 #3
Solved my problem.
Thank you very much!

TIRislaa

"Mark Fitzpatrick" <ma******@fitzm e.comskrev i melding
news:eH******** ******@TK2MSFTN GP04.phx.gbl...
It comes from the Request.QuerySt ring collection. I forget the VB code,
but in C# it's:

Request.QuerySt ring["myParam"].ToString()

Keep in mind, before you ever attempt to reference it, you'll need to make
sure that it is not a null value. If you don't test for null first, and
the querystring variable isn't present (it could be there but misspelled
for example) then it will through a null reference error when you attempt
to use the ToString() method on it. Always test for null first just in
case.

in C# the test woud be:

if(Request.Quer yString["myParam"] != null)
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Tor Inge Rislaa" <to************ @rislaa.nowrote in message
news:uB******** ******@TK2MSFTN GP06.phx.gbl...
>Passing and using parameters

How to get hold of the parameter value provided by the URL? When I open a
web form with a DataSource I often include a parameter in the URL as
below:

myNewPage.aspx ?myParam = 10

If I simply need to use the value of myParam in the VB code when the new
page load, how do I refer to the parameter?

e.g. myLabel.Text = myParam (where myParam is replaced with a proper way
to refer to it)

TIRislaa



Dec 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
17347
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures (update, append) should be activated in order to transfer data to other tables. I tried to avoid any coding in VB, as I am not a professional, but I...
3
14916
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
12
2787
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of function descriptors for the overloaded functions of that name. A function descriptor would contain the address of the function to be called, and a...
7
2839
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID);...
2
5261
by: Bob | last post by:
I'm new to Access projects and SQL server and am not a veteran VB programmer. There's a cry for help! I'm attempting to print the current form on screen by using a command button which the user clicks once they have selected the desired record. The button calls a report which uses a stored procedure as its record source. The SP has 2 input...
17
3577
by: Charles Sullivan | last post by:
The library function 'qsort' is declared thus: void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); If in my code I write: int cmp_fcn(...); int (*fcmp)() = &cmp_fcn; qsort(..., fcmp); then everything works. But if instead I code qsort as:
8
4401
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup...
4
3828
by: Nathan Sokalski | last post by:
I am a beginner with AJAX, and have managed to learn how to use it when passing single parameters, but I want to return more than one value to the client-side JavaScript function that displays it. My client-side JavaScript function takes 4 parameters (which are expected to be integers). The idea of passing a single parameter and parsing it on...
2
4424
by: luis | last post by:
I'm using ctypes to call a fortran dll from python. I have no problems passing integer and double arryas, but I have an error with str arrys. For example: ..... StringVector = c_char_p * len(id) # id is a list of strings Id_dat=StringVector() for i in range(len(Id)): ....Id_dat=id
3
4489
by: ajaymohank | last post by:
hello everyone..... i am ajay and i am new to php. in my project i have an option to invoke a bat file by passing parrameters and to diplay the result. i tried this code but my page got hung or display nothing... exec("c:\collabland\collabland.bat $distcode $tlkcode $villacod $block $svno"); here by passing this parameters to...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.