Conventional Controller
Published on Sun 16 Dec 2007 12:12 ( 2 years, 2 months ago)
ASP.NET MVC action method we need to call RenderView("viewname"), ASP.NET MVC will look the viewname.aspx under "view/action/" and "view/shared". In Ruby On Rails, this step is not required, Rails will try to find same name view under view directory.
Can we do that in ASP.NET MVC, Phil Haack has done this:
http://haacked.com/archive/2007/12/09/extending-asp.net-mvc-to-add-conventions.aspx
So instead of writing your controller like this:
public class HomeController : Controller
{
[ControllerAction]
public void Index()
{
//Your action logic
RenderView("Index");
}
}Using my class you could write it like this
public class HomeController : ConventionController
{
public void Index()
{
//Your action logic
}
}
Related posts:
- To "refresh" a SqlDataSource.
- asp:ControlParameter vs asp:FormParameter
- output a line in a batch *without* crlf
- Write code with no getters???
- Dump SQL Server Express' DB Schema
- My suggestions on Web2py's route design
- Good comparing of GAE Data Store .vs. Amazon Simple DB .vs. MS SSDS
- Very good articles on MVC, MVP and more.
- Presenter First approach in MVP
- ASP.NET MVC Preview 3 just released
Search related in web:
Custom Search