Thursday, September 16, 2010

Why Semi column on asp.net mvc aspx engine not required

<%= Html.ValidationMessage("currentPassword") %> doesnt require semicolon but

<% Response.Write(Html.ValidationMessage("currentPassword")); %> requires semicolumn because the former requires an expression rather than a statement.

Sunday, September 12, 2010

Following code will not work in Mozilla..However work in IE Passing "div_1" element as a parameter is not compliance with W3C compliance. Need to analyze later

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script type="text/javascript">
function showLoginPopUp(curEl,sd) {
alert("hi");
}
</script>
<a id="lgn" onclick="showLoginPopUp(this,div_1);return false;" href="#" >Login</a>
<div id="div_1"></div>

Thursday, September 2, 2010

ASP.NET MVC: HTTP Error 404.0 Use Integrated Managed Pipeline Mode

In IIS7.5 :- Server Error in Application "STYLECORD.COM"

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Solution:-

The IIS application under which an ASP.NET MVC application runs has to be set up to use Integrated Managed Pipeline Mode

Passing Multiple Parameter to Controller Methods

I came across a scenario, to pass more parameters in the controller. Product-> sub product -> sub-sub- product. and most of the suggestion in the website request us to create a querystring with /id?param1=""¶m2=""

But, I found the following is working for me (MVC 2)

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}/{param1}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional, param1 = UrlParameter.Optional } // Parameter defaults
);

}

mmm... also found the sme in http://forums.asp.net/t/1500133.aspx

This should be possible in MVC 1.The OptionalParameter is a new feature in MVC 2 inclusion, but in MVC1 I think same should be possible by passing empty string.