ASP.NET MVC


We are about to talk about client validation soon, but if you already know about it, read on; if not, wait until my next post and come back to this one :-).  I’m writing this now because I just found it.  If you use client validation, it’s important to ensure you enable client validation before the […]

ASP.NET MVC 1 had features built in that allowed you to validate content on the server-side, by specifying the elements to listen to validations for.  These features have been enhanced so that you can use a lambda to specify the field to validate.  Below is an illustration of these new features. <% Html.BeginForm(); %> <%= Html.ValidationSummary(“The […]

    <p> Ajax Custom</p> <p>  <div id=”customresponse”></div>  <% using (Ajax.BeginForm(“AjaxCustom”, new AjaxOptions { UpdateTargetId = “customresponse” })) { %>      <div>   Name: <%= Html.TextBox(“CustomName”)%>  </div>  <div>   Value: <%= Html.TextBox(“CustomValue”)%>  </div>      <input type=”submit” value=”save” />    <% } %></p>   [HttpGet, ChildActionOnly]public ActionResult AjaxCustom(){ return PartialView();} [HttpPost]public ActionResult AjaxCustom(FormCollection post){ return Content(“Success”); //return PartialView();} public ActionResult AjaxIndex(){ return View();}

In ASP.NET web forms, anytime an element within the form post contains an HTML tag (such as a <div> or any other tag), the input that’s posted back to the server is validated, and an exception thrown, if that post contains any HTML tags within it.  This is request validation, and in web forms it can […]

ASP.NET MVC 2 has provided a lot more options for displaying the data to the end user within your views.  Here are a few of the options you have: Html.DisplayFor(i => i.FirstName) – DisplayFor renders the value of a property directly to the browser.  In this example, the FirstName property returns a string, which gets rendered.  […]

You may or may not have heard that ASP.NET MVC 2 has been released not too long ago.  There are quite a few changes that come with ASP.NET MVC 2.  In this article, I’m going to talk about some of the attribute changes related to MVC 2 now available to us: ChildActionOnly – This attribute […]

Like web forms, MVC allows you to customize the building blocks for developing in MVC. Extension helpers are so easy to write because all it takes is an extension method like the following: public static class MyExtensions{    public static string CustomHiddenField(this HtmlHelper html, int key)    {         return string.Format(“<input type=’hidden’ value='{0}’ />”, key);    }} And now […]

The Telerik MVC grid that comes with Telerik’s MVC open source framework is awesome.  It really rocks; it has a lot of the features that exists within the ASP.NET AJAX framework are also in this grid implementation.  Not only that, it implements MVC syntaxes for constructing the UI.  Because the grid uses Action classes to […]

ASP.NET MVC gives you a lot of options when you want to customize the way that ASP.NET MVC uses controllers.  By default, ASP.NET uses a controller factory to handle MVC controller requests.  A ControllerActionInvoker class, related to the controller, is solely responsible for invoking action method requests and returning the results.  It is this class […]

ASP.NET MVC is a wonderful thing.  One of the many great features is the ability to customize all of the .NET framework’s code by swapping out one implementation and using another.  One such instance is creating a custom view engine, which you can do as illustrated in this example: http://www.singingeels.com/Articles/Creating_a_Custom_View_Engine_in_ASPNET_MVC.aspx.  The point of my article […]

« Previous PageNext Page »