ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods


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


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));


var queryStringVal = this.GetQueryStringValue<int>("param");

Author: James Levingston

Submitted on: 26 jan 2011

Language: C#

Type: System.Web.UI

Views: 5563