Monday, April 29, 2013

How to create image link in ASP.NET MVC?

@Html.ActionLink("buttontext", "actionName", "controllerName", null, new { @class="alinkimage" })

CSS definition:

a.classname
{
background: url(../Images/image.gif) no-repeat top left;
display: block;
width: 150px;
height: 150px;
}

Saturday, April 27, 2013

How to encode url in ASP.NET MVC 3

HttpContext.Current.Server.UrlEncode(text)

Wednesday, April 24, 2013

The best interface is no interface




http://www.cooper.com/journal/2012/08/the-best-interface-is-no-interface.html/

How to validate Canada postal code by regular expression?

^[ABCEGHJKLMNPRSTVXY]\d[A-Z]\d[A-Z]\d$
Code example for ASP.NET webform  RegularExpression validator

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="*" ControlToValidate="TextBoxPostalCode" ValidationExpression="^[ABCEGHJKLMNPRSTVXY]\d[A-Z]\d[A-Z]\d$"></asp:RegularExpressionValidator>

Basic Concept
http://en.wikipedia.org/wiki/Regular_expression
Online Regular Expression tester
http://www.regular-expressions.info/javascriptexample.html