Tuesday, April 6, 2010

How to fix missed Navigate Backward and Forward buttons in Visual Studio

In VS Click Tools,
Import and Export Settings,
select Import Selected environment settings and click Next,
select Yes, save my current settings and click Next,
select General Development Settings, and click Finish.


Or use shortcut: Ctrl+- and Ctrl Shift +-
http://blogs.msdn.com/b/zainnab/archive/2010/03/01/navigate-backward-and-navigate-forward-vstipedit0024.aspx

Monday, March 22, 2010

How to submit once in ASP.NET webform by jquery?

Add two properties into server side button:
UseSubmitBehavior="False"
OnClientClick="$('.Buttons').attr('disabled', 'true');"

Wednesday, November 11, 2009

How to filter Exceptions (Such as null parameter) in MVC?

Override your OnException in your controller:
protected override void OnException(ExceptionContext filterContext)
{
if (IsNullParamter(filterContext.Exception))
filterContext.HttpContext.Response.Redirect("~/Home/Index");
base.OnException(filterContext);
}

private bool IsNullParamter(System.Exception ex)
{
string error = ex.Message;
if (error.Contains("System.ArgumentException: The parameters dictionary contains a null entry for parameter")) return true;
if (error.Contains("The parameters dictionary contains a null entry for parameter")) return true;
return false;
}