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