In .Net, sometimes, you must work with a querystring with many parameters and then, based on that, you must assign values to labels, textboxes or the like. Fortunately, it’s not that hard. Here, I’ll break it down into three parts – grabbing the entire querystring and then getting the individual parameters, followed by assigning them to whatever controls you have on the page.
Grabbing the current URL with Querystring:
Uri myUri = new Uri(Request.Url.ToString());
Then, based on that variable, you can start assigning the separate querystrings to variables (just in case you need them in multiple places).
string system= HttpUtility.ParseQueryString(myUri.Query).Get("sys"); string category= HttpUtility.ParseQueryString(myUri.Query).Get("cat");
Lastly, you can populate labels, textboxes or whatever, using those variables:
lblSystem.Text = sys; lblCategory.Text = cat;code>
Naturally, you can trim this down to 2 steps, skipping the variables if you'd like. As Bob Ross used to say, "It's you world".
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF