Jeroen Derde's Blog

My Software Engineering Universe

Microsoft tech-ed 2010 Sessions

clock December 1, 2010 00:23 by author Jeroen Derde

 Had a really great time at Tech-Ed europe this year. Thanks to Schuberg Philis for doing the Dutch "Back To The Future" County Drink, it rocked.

Some of the sessions I visited and liked, you should watch these videos at Tech-ed Online:

 

Great session by Dino Esposito about Design considerations when building ASP.Net MVC applications

http://www.msteched.com/2010/Europe/WEB402

Whats new in ASP.Net MVC 3 by Jonathan Carter @lostintangent

http://www.msteched.com/2010/Europe/WEB309

Nice OData session to get started

http://www.msteched.com/2010/Europe/DEV203

And one to deep dive into the previous session

http://www.msteched.com/2010/Europe/DEV312



WittyTwitter TwitterLib

clock July 14, 2009 23:34 by author Jeroen Derde

 

Found this .Net wrapper for the Twitter API called TwitterLib. It's part of WittyTwitter, but can also be used on it's own.

Code can be found here. http://wittytwitter.googlecode.com/svn/trunk/Witty/TwitterLib/
Nice if you are planning on building a twitter enabled app.

 

 

 



ComplexModelBinder

clock July 10, 2009 01:29 by author Jeroen Derde

Today I was experiencing a problem in the MVC application I am currently developing.

First some information:

Model: ContactDataModel
ContactDataModel implements interface IContactData. This is because the related typedview Step1 contains a partialView that inherits IContactData.
this way we can reuse the partial view simply by having each model, that needs to use the partialview, implement this interface.

 

Interface IContactData


public interface IContactData
{
    ContactData Contact { get; set; }
}

 

Object ContactData


public class ContactData
{
    [Required]
    [StringLength(200)]
    public string Voornaam { get; set; }
}

 

View: Step1
This view inherits from ContactDataModel


...
<h2>ContactGegevens</h2>  
<% Html.RenderPartial("ContactDataUserControl"); %>
...

 

Partial View: ContactDataUserControl
This view inherits from IContactData


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QNH.Interfaces.IContactData>" %>
<%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
<% using (Html.BeginForm()) {%>
<fieldset>
    <legend>Fields</legend>
    <p>
        <label for="Contact.Voornaam">
            Voornaam:</label>
        <%= Html.TextBox("Contact.Voornaam")%>
        <%= Html.ValidationMessage("Contact.Voornaam", "*")%>
    </p>
.........more fields....form closed

 

Controller: MyController


[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Step1( ContactDataModel contact )
{
    ....
}

 

The "POST" method "Step1" on MyController was recieving an empty ContactDataModel object. If I changed the the Step1 method to recieve the FormCollection instead of the Model object then my values would be present. After this I thought: what object is responsible for mapping the formvalues in my view to my model object. The answer is: the ComplexModelBinder.

The main thing to remember when using the ComplexModelBinder is the naming convention of your controls in the form. Because it uses reflection the ComplexModelBinder is expecting the Class Name + “.“ to be appended to the property name. If you are using the ComplexModelBinder and not prefixing the Class Name to the name of the Property, you will just get null values for your properties.

This means that in my partial view were I was using Contact.Voornaam I needed to use ContactData.Voornaam.This also means that I needed to change the name of the property in my interface to ContactData, because else it would not be recognised.

New Interface: IContactData:


public interface IContactData
{
    ContactData ContactData { get; set; }
}

New Partial View: ContactDataUserControl
This view inherits from IContactData


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QNH.Interfaces.IContactData>" %>
<%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
<% using (Html.BeginForm()) {%>
<fieldset>
    <legend>Fields</legend>
    <p>
        <label for="ContactData.Voornaam">
            Voornaam:</label>
        <%= Html.TextBox("ContactData.Voornaam")%>
        <%= Html.ValidationMessage("ContactData.Voornaam", "*")%>
    </p>
.........more fields...form closed
 

 

I really hope this helps out someone else. Happy Coding.

 



xVal - a validation framework for ASP.NET MVC

clock June 24, 2009 03:03 by author Jeroen Derde

Via Codeplex, and a bit later on Steve Sanderson’s blog I found some information on xVal.
xVal is, as the title of this post states) a validation framework for ASP.Net MVC.

 

A qoute from Steve's post that got me very exited to start using xVal.

"xVal lets you link up your choice of server-side validation mechanism with your choice of client-side validation library.
It guides you to fit them both into ASP.NET MVC conventions, so everything plays nicely with model binding and errors registered in ModelState."

What this means to me is that I can implement clientside validation via JQuery Validation(http://docs.jquery.com/Plugins/Validation) but if the client does not support JavaScript all validations will also be done serverside.
The validation is also only defined once (on the modal) which makes for much easier maintenance. This is quite a big deal because many of our customers require that the webapplications we build adhere to the accessability rules set by the Dutch government.(http://www.drempelsvrij.nl)

Order a pile of pizza's because I'll be experimenting with xVal and ASP.Net MVC the next couple of days.

PS: if you don't know about DataAnnotaions yet, read this first: http://bradwilson.typepad.com/blog/2009/04/dataannotations-and-aspnet-mvc.html



Web Platform Installer 2.0 Beta

clock June 24, 2009 01:20 by author Jeroen Derde

Today I was creating a new Virtual PC to do some ASP.Net MVC programming. After duplicating my standard image I went to http://www.asp.net/mvc/download/ and was preparing myself to download a couple of installers. Then I saw a button in the top left corner that said: Install Now with the Microsoft Web platform installer.

Web Platform Installer is like a stack. It enables you to install everything you need to start web developing at once and then some more.

This made getting my development machine up and running much easier. It also introduced me to some tools I had never heard of before, which is a big plus aswell.

 

 

 

 

 

 

 




Month List

Calendar

<<  December 2017  >>
MoTuWeThFrSaSu
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Sign in