GetQueryStringValue

using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web;

namespace WebExt
{
    public static class WebExt
    {
        public static T GetQueryStringValue<T>(this UserControl control, string name)
        {
            return (T)Convert.ChangeType(control.Request.QueryString[name], typeof(T));
        }
    }
}
Example:
var queryStringVal = this.GetQueryStringValue<int>("param");

Description

Gets a query string value from a System.Web.UI.UserControl HTTP Request object.

Details

Double click on the code to select all.

 

;