ASP.NET MVC


I know the new MVC 5 HTML tag attributes for rendering ASP.NET widgets is all the rage, but there are a lot of useful approaches to using the server-side HTML helpers.  One simple extension method we are going to look at is adding control level security.  Often within our applications, we have a means of […]

In many social networking sites, pasting a URL from a news site into Facebook or Linked In displays a nice synopsis of that link.  The URL pasted into such status box is read, capturing information about the page and it’s specific contents, such as a title,description, thumbnail, etc.  One common technique used is to extract […]

I was looking at the MVC ReCaptcha project available at http://mvcrecaptcha.codeplex.com/.  It’s a pretty simple to implement into your MVC project, and its effective  for implementing the core captcha capabilities quickly.  The framework wraps the ASP.NET web forms control that is available on Google code, for which Google has not created its own MVC implementation (to […]

You may have already experienced this, and I know that I experienced it before, but I experienced it again and forgot about it, and so I figure it would be a good time to blog about it.  (When I blog, I remember things better).  If you happen to use the using syntax with Html.BeginForm as […]

One of the selling points of ASP.NET MVC 2.0 was the ability to unit test your action methods.  Even though Microsoft made MVC flexible by making it easier to unit test than web forms, it isn’t always easy to implement without writing a lot of code to implement fakes for common services you use or […]

Html.Action is a method method that injects a response from the server directly into the UI.  For instance, a controller can have two action methods, then inject the response directly into the UI from the other controller.  Take a look at the sample form below: <p> Main Action</p> <% Html.BeginForm(); %>  <div>  Name: <%= Html.TextBox(“IndexName”) %> </div> <div>  […]

The freely available ASP.NET MVC framework by Telerik has added a new DatePicker control that works similarly to the RadDatePicker control in its ASP.NET AJAX framework.  Below is a sample of that control: <%    Html.Telerik().DatePicker().Name(“Picker”)        .ButtonTitle(“Select Date”)        .ClientEvents((evt) =>            {                evt.OnChange(() =>                    {        […]

The latest release of the open source Telerik ASP.NET MVC framework contains a new calendar control.  This control functions similar to the ASP.NET AJAX calendar extender calendar, where it shows a month view, year view, and decade view, and responds to clicks on the client.  Telerik can also specially process clicks for the server too.  […]

With the new various For methods in MVC (DisplayFor, TextBoxFor, etc.), these methods use a lambda to specify the fields to display/render.  The following form below: <% Html.BeginForm(); %>  <%= Html.ValidationSummary(“The following errors have occurred:”) %>  <%= Html.Hidden(“Story.ProjectPhaseKey”, this.Request.QueryString.Get(“phase”)) %> <%= Html.Hidden(“Story.ProjectKey”, this.RouteData.Values[“id”])%>  <div>  <span>Title</span>  <span>   <%= Html.TextBoxFor(i => i.Story.Title) %>  </span> </div> <div>  <span>Description</span>  <span>   <%= Html.TextAreaFor(i => i.Story.Description) %>  </span> </div>  <div>  <input type=”submit” value=”Save Changes” […]

 Not only does MVC support server-side validation, client-side validation is a possibility too.  Below is a sample form that sets up validation using client-side javascript.  These client-side features are made available from the MicrosoftMvcValidation.js file.  Take a look at the sample form with validation below. <% Html.EnableClientValidation(); %> <% Html.BeginForm(); %> <%= Html.ValidationSummary(“The following errors […]

Next Page »