ASP - URL query

Asked By Randy Inaneway
03-Nov-09 01:06 PM

I think I was able to query 2 values from 1 field but I can't remember how.

Example: field contains values 1, 2 , 3 for different records. I want to return 1 & 2 somthing like this:

pagename.asp?SWITCH=1

pagename.asp?SWITCH=2

that works fine but I want to return 1 AND 2

 

pagename.asp?SWITCH=1&2 does not work. It seems I did somthing like SWITCH=[1][2] or something similar some time ago and it worked but I just can't recall.

Is this possible or am I dreaming?

Thank you very much

 

 

 

 

 

 

re  re

03-Nov-09 11:00 PM

in URL passing querystring '&' use for seprate two different variables in url so u don't use 1&2

so u can wnat to get two value passing in query string then try this way

pagename.asp?SWITCH=1,2

and then u will split on comma(,) and get 1 and 2

or u can use this

 pass two value then use two different variable as follows

pagename.asp?SWITCH=1&SWITCH2=2

Couple of ways.  Couple of ways.

04-Nov-09 12:31 AM

You would use the same variable name with your multi-values and create the url. However, a note of caution that there is a length limit to the querystring. Instead you would ideally use other ways of communicating between two asp web pages.

And also note that the Ampersand ("&") is used to separates parameters and not to concatenate them.

You can also give the values as comma separated and then use the indices to retrieve each one of them. But again, this is not adviced as it involved code change in the dependant file once the query string changes in your calling code.

If the param in the Querystring is called "myParam" and has the value "a, b, c"; to retrieve all of them you would write,
Response.Write Request.QueryString("myParam")
And to retrieve each one of them you would do ,
Response.Write Request.QueryString("myParam")(1) ' would give a
Response.Write Request.QueryString("myParam")(2) ' would give b
Response.Write Request.QueryString("myParam")(3)
' would give c

also not that in ASP, you could give the same name to the request querystring variables and still retrieve values.
Like the following example.
http://localhost/webfolder/page1.asp?param1=a&param1=b&param1=c

Response.Write Request.QueryString("param1")(1) ' would give a
Response.Write Request.QueryString("param1")(2)' would give b
Response.Write Request.QueryString("param1")(3)' would give c

asp  asp

09-Nov-09 02:09 AM

http://localhost/Website/page1.asp?n=1&n=2&n=3

for i=1 to Request.QueryString("n").Count
  Response.Write(Request.QueryString("n")(i) & "<br />")
next

It Will GIve
1
2
3

Create New Account
help
Web APPLICATION What is query string in asp.net explain me with an example? Query string is used for passing variables content between pages ASP.NET. Query string format http: / / www.localhost.com / Webform2.aspx?name = Atilla&lastName = Ozgur This html addresses use QueryString property to pass values between pages. In this address you send 3 information. 1. Webform2 3. lastName = Ozgur you send a lastName variable which is set to Ozgur / / To write query string private void btnSubmit_Click( object sender, System.EventArgs e) { Response.Redirect( "Webform2.aspx?Name = " +txtName
regarding query string i want that query string should not be visible on the address bar i have tried using method = "post" but it is still showing query string please reply HI You should encrypt and decrypt the data (or) What you can do in the receiving. But you cannot make them invisible. Hi. . . use encrpt and decrpt the query string. . . The function for encrypting the query string is below: Public Shared Function TamperProofStringEncode(ByVal value
About String Query What is string Query plz tell me in explain. . . . . . . . way. what is its main purpose. my concept is not clear about it Thanks. . . . . . . . . . What are Query Strings? Query strings are data that is appended to the end of a page URL. They are t confidential. Unlike ViewState and hidden fields, the user can see the values which the query string holds without using special operations like View Source. An example of a query string can
About Query String in ASP. . . Hi, I'm new to Classic ASP have no clues. 1: How to get / pass query string from one page to another page in Classic ASP. 2: After query string is got Do we need to convert Query string or do we need to decrypt the query string? I'm completely dark. . . Please help
Query string Hi All, Please let me know more detail about Query string A query string is the part of a URL that contains data to be passed to web applications forumpostsubmission.aspx?topicid = 2&forumpostid = 10161717 In this example topicid = 2&forumpostid = 10161717 i s query string with two variable topicid and forumpostid. your server scripts normally reads the query string and