URL Parameter Retrieval

Deanna Martens asked on August 20, 2015 22:35

Hello,

Is there a way to get and use the URL parameter of a page in the code of a custom filter control?

Thank you, Deanna

Correct Answer

Roman Hutnyk answered on August 21, 2015 05:02

Deanna,

URLHelper class provides this type of functionality. Also you may use ASP.NET method: Request.QueryString["parameter_name"]

Hope this helps.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Deanna Martens answered on August 21, 2015 14:03

Thank you so much!

I had gone through some of the URLHelper methods before and couldn't get it to do exactly what I needed but I just tried the Request.QueryString["parameter_name"] and it worked perfectly. Thank you again.

1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 21, 2015 18:42 (last edited on August 21, 2015 18:42)

Hey Deanna,

You can also use the macro like so if you have a webpart:

{% QueryString.GetValue("paramName") #%}

or

{?paramName?}

Both will work but the ? macro is specifically designed for query string retrieval. The % macros are designed for data retrieval. See the documentation here.

0 votesVote for this answer Mark as a Correct answer

Deanna Martens answered on August 21, 2015 18:50

Hi Brenden!

That's good to know, thank you

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.