July 2008

Simple Form Helper

As I continue to use JQuery and MVC I am completely impressed with how much you can do with very little. I know the new preview 4 came out with an AjaxForm helper. I could not resist, so I made my own and added it to the whole controls project I've been working on. (I have not forgot about the grid, but I've gotten a little bored of it for the time being although I do want to finish it...). So here is the idea:

  1. Have complete control over HOW the form is rendered
  2. Be VERY light (I attached the whole thing to the onSubmit attribute on the form)
  3. Make it fast (it took me like a half an hour or so)

Continue reading JQuery MVC Form Helper

Read more

Well, I finally upgraded to BlogEngine.NET 1.4 (patch and all). It took about 40 minutes or so (I was overly cautious of course). I am currently using SQL Server as the provider. Thanks to Al Nyveldt everything went smoothly. Overall, I like the widgets on the side. Everything else seems to be about the same (again I just finished installing). So far I like what I see!

Read more

Moving away from ASP 3.0 Request.Form(" ...

As mentioned in my previous post, I wanted to find a way to auto-populate and entity object from the Request.Form collection. I also wanted (as an aside) to see if the grid still worked on MVC Preview 4 (it does). Here is the code:

public static T Request<T>(this Controller controller) where T : class, new()
    T o = new T();
    var request = controller.Request;
    foreach (var property in typeof(T).GetProperties())
        // Check if the object has the appropriate property
        var q = (request.Form.AllKeys
            .Where&lt;string>(s =&gt; s.ToLower() == property.Name.ToLower()))

        // if more than one... ignore
        if(q.Count == 1)
             string datum = request.Form[q[0]];
             if (property.PropertyType == typeof(string))
                 property.SetValue(o, datum, null);
                    Convert.ChangeType(datum, property.PropertyType),

    return o;

Continue reading MVC Form Helper

Read more

Moving to an HTML Helper

As I was looking around at the various HTML helpers out there, I realized that I should probably conform and stick to what is being done. Having said that, I refactored the Grid class to be a new HTML helper. Here is how it is used (similar to an MvcForm<T> actually):

<% using (Html.GridControl<StudentController, StudentEntity, int>(
   s => s.EditStudent(), 
   s => s.DeleteStudent(), 
   s => s.StudentId, 
   null)) {  %>
Special text here!
<% } %>

Continue reading Ajax HTML Grid Control for ASP.NET MVC (Part 3)

Read more


Over the long weekend I thought a lot about where I wanted to go with the grid "control" for ASP.NET MVC. One of the things that weighed heavily on my mind was the ability to have the control fully customizable. As I thought about this, I decided that first thing's first: I need to get the functionality working and then worry about the prettiness factor. So for those of you concerned about the customizability - it's coming. For now, I really want to focus on the ability of the grid to get work done.

Continue reading Ajax HTML Grid Control for ASP.NET MVC (Part 2)

Read more

At work we are starting a major project and I think we have decided to go the ASP.NET MVC route. One of the concerns we had was that we could not use traditional "web controls" (i.e. Telerik, DevExpress) since the all require the <...runat=server> portion. With that said, I thought I would start to take a look at how I would go about doing it! The first "control" I want to get off the ground is a data bound grid that allows asynchronous saves via JavaScript. We'll see how it goes!

Continue reading Ajax HTML Grid Control for ASP.NET MVC (Part 1)

Read more