njj56
njj56

Reputation: 621

how to use request.querystring properly

In my page URL, there is a property taskgrpid - In my code I would like to use the value as an integer. Listed below is the URL from the page and here is my request for the string. Please tell me why I am always getting a value of 0 for x. Thank you

http://localhost:2098/observations/ViewObservation.aspx?taskgrpid=55&taskgrpcategory=11&ptaskgrpid=390&ptaskgrpcategory=10

dim x as integer = request.querystring("taskgrpid")

update, for some reason this works at page load, but not in any other functions that i have called, any suggestions?

Upvotes: 0

Views: 886

Answers (1)

competent_tech
competent_tech

Reputation: 44961

Change:

dim x as integer = request.querystring("taskgrpid")

to:

dim x as integer = CInt(request.querystring("taskgrpid"))

Upvotes: 1

Related Questions