tags:

views:

27

answers:

0

Hi!

I'm using a ViewModel and EditorTemplates to build up a specific view.

Customer is a Linq-2-sql generated object and Customer.Client is a simple string.

This:

<%= Html.EditorFor(x => x.Customer.Client) %>

renders to:

<input id="Customer.Url" name="Customer.Url" type="text" value="http://www.golang.com" />

The recieving action has the following signature:

ActionResult Settings(int id, Customer customer);

If I try to call UpdateModel on customer, it will fail.

The ModelState contains no errors.

If i change my EditorTemplate to this:

<%= Html.EditorFor(x => x.Customer.Client, "", "Url") %>

it works fine.

Why is this?

Is there a better way to do this?

Thanks