Thursday, May 28, 2009

Some number in Ajax usage among .NET developers

Source
- the most used web frameworks is pretty obviously WebForms (89%) followed by ASP.NET MVC (38%);
- the most used JavaScript library is jQuery with 76%, followed by Ajax Control Toolkit (58%) and ASP.NET Ajax (48%). And still a good 8% is hand-crafting javascript and ajax calls;
- among the ones using ASP.NET Ajax, the vast majority is using the UpdatePanel control (88%) and 58% is using the ASP.NET Ajax client library and talking directly to Json/XML services.

Tuesday, May 26, 2009

How to deal with disabled Javascript in Browsers in ASP.NET MVC

Add noscript html tag into master page to redirect description page:
<noscript>
<meta http-equiv="refresh" content="5; url=<%= Url.Relative("~/ControllerName/ActionName") %>" />
</noscript>

Monday, May 25, 2009

Cache in MVC ActionFilterAttribute

Source

How to add HTML Attributes into html helper

<%=Html.DropDownList("CategoryID", new {@class="input", style="display:none"})%>

Friday, May 22, 2009

Simplest way to redirect user to maintaining page

Just add an HTML file named “app_offline.htm” to the root directory of your website. Adding this file will clear the server cache. When ASP.NET sees the app_offline.htm file, it will shut-down the app-domain for the application (and not restart it for requests), and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application.

The size of the file should be more that 512 bytes to be displayed.

Thursday, May 21, 2009

New for web development in Visual Studio 2010

Source

Dynamic IntelliSense for JavaScript
Snippets for HTML and JavaScript

Tuesday, May 19, 2009

DevHawk - Microsoft, Open Source and ASP.NET MVC

Source
...
Personally, I think Microsoft is making small steps in the right direction when it comes to Open Source. Not only have some high profile Microsoft projects go Open Source like ASP.NET MVC and MEF, but we’ve even started taking baby steps for including external intellectual property. Releasing ASP.NET MVC under Ms-PL is a big deal, but I think including jQuery “in the box” is a much, much bigger deal. It remains to be seen if it’s a one-time-only deal or if it’s a new trend inside Microsoft.
...

Monday, May 11, 2009

Martin Fowler: Any fool can write code that a computer can understand. Good programmers write code that humans can understand

Website

ActionButton with Controller name and Action name in ASP.NET/MVC

using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;

public static class Action
{
public static string ActionButton(this HtmlHelper helper, string Url, string Text)
{
return GetHtmlBy(Url, Text);
}

public static string ActionButton(this HtmlHelper helper, string ControllerName, string ActionName, string ButtonText)
{
var urlhelper = new UrlHelper(helper.ViewContext.RequestContext);
string virtualpath = string.Format("~/{0}/{1}", ControllerName, ActionName);
string absurl = urlhelper.Content(virtualpath);
return GetHtmlBy(absurl, ButtonText);
}

private static string GetHtmlBy(string Url, string Text)
{
string outputUrl = string.Format(@"
<input type='button' onclick=""javacript: window.location='{1}';"" value='{0}' />", Text, Url);
return outputUrl;
}
}


You can use this ActionButton in aspx file:

<%=Html.ActionButton("ControllerName","ActionName","ButtonText") %>

Thursday, May 7, 2009

Link: ASP.NET 4.0 Webforms Enhancements

Source

More Granular ViewState Control and Webforms Routing