Saturday, 19 May 2012

Get Querystring Parameter

 public virtual T GetQueryString<T>(string name)
{
string queryParam = null;
if (Request.QueryString[name] != null)
queryParam = Request.QueryString[name];

if (!String.IsNullOrEmpty(queryParam))
return (T)TypeDescriptor.GetConverter(queryParam.GetType()).ConvertFrom(null, Thread.CurrentThread.CurrentCulture, queryParam);

return default(T);
}

No comments:

Post a Comment