Thanks Bertrand. Further to this, my views list objects and use html.ActionLink to view the details (via Routes and Controllers). These by default (with [Themed]) appear in the Content Zone. What is the best way to move the default content to a different
layout in the Controller? Placement.info?

@pcs: placement only works for dispatching content parts into local zones, not for arbitrary shapes. To put stuff in other parts of the page, you need to access workContext.Layout.Zones["NameOfTheZone"].Add(shape, "1")

I found another topic (http://orchard.codeplex.com/discussions/233941) where you saying

You need to choose between using a strongly typed view model like lots of editor views are still doing, or use shapes. If you use shapes, you'll need to use the non-strongly-typed overloads of the Html helpers, or shape templates, or shape methods for
rendering.

So I guess my question would be how to write module defining Widgets which not using shapes?

For the front-end, I don't think you can. Then again, you don't need the Lambda-based Html helpers there. Also, what I said was incomplete, you can actually use the Lambda helpers if you have a strongly typed object as one of the fields of the shape, if
you cast them properly. Or, as I said, just use the non-strongly-typed helpers, they work just fine.

you can actually use the Lambda helpers if you have a strongly typed object as one of the fields of the shape, if you cast them properly

Can you give simple example of this, sorry for asking, but I'm not very experienced yet in Orchard, but trying my best to improve in this area. thanks

I could use non-strongly typed helpers, but then I guess I will loose for example ability to create correct Labels for my input controls for which I have properties in my ViewModel with attribute DisplayName

Never mind that, it doesn't exactly work. One thing you can do though is set the Model property on your shape, and that will set what is used as Model in the view. You can then declare the type of the model on top of your razor file the way you would usually.

Never mind that, it doesn't exactly work. One thing you can do though is set the Model property on your shape, and that will set what is used as Model in the view. You can then declare the type of the model on top of your razor file the way you would usually.

I've tried this, but doesnt appears to work, or I did not understand what you are suggesting

oh, and another idea may be to have an interface that fits your shape. If you declare the model in the view to be of type that interface, the Clay shape will probably be cast to the interface and it may start working. (but I would also encourage you to try
the non-strongly-typed helpers, that's by far the easiest solution).

Well. When I have strongly-typed view I could write such method on my controller

[HttpPost]public ActionResult Send(ContactUsPart model)

and have strongly typed model object already populated with data entered by user.

By "old style", I mean non-strongly-typed viewes, where you need to create model object yourself (Controller method do not accept it as parameter), and update it with data from forms with the following method

I don't think it's true that you need a strongly typed view for the controller action to be able to accept strongly typed parameters. If the model binder fan find the form fields it needs, it will map that just fine.

I ran into the above problem as well. The error occured in the controller in the POST. The return from UpdateEditor is a shape, which is a dynamic object. If the ModelState in invalid (input validations failed) then originally I was passing
the shape. which is assigned to the model var, directly to the view. This was causing the error. After inspection of the shape, I noticed that it contained a Content Item, which contained a list of Parts. One of the Parts was of the type
I needed to send to my view. I simply iterated through the list, got the part I was looking for, and passed it to the view.

We are planning to use widgets in our project. we have a login page for which we have created a part. While rendering this we are getting the below error.

"The model item passed into the dictionary is of type 'IShapeProxy674961fc5cfc4f5d94549fd4941a65b8', but this dictionary requires a model item of type 'MyApplication.Models.Login'".

As suggested above, we could resolve the above issue by using non-strongly typed html helpers. However this approach does not completely fit to our requirement, as we have already developed the application using strongly typed views and controllers.

we want achieve the below:
1. we want to use login model (our own) for displaying this part.
2. After posting the data, we need to validate credentials and if they are not valid, we need to show "Invalid credentials" message to end user. For this, currently we are setting login model properties to null and message property to "Invalid
credentials" and re-rendering the view. please suggest how we can achieve the same using part.

Oh, so the model of your view is not strongly typed, but dynamic. Extension methods can't work with dynamic, so what you need to do is store your strongly typed view model in a local variable, and use that local variable with the HTML helpers. E.g.:

With the change you suggested we could overcome the issue of strongly typed HTML helpers.

If I type wrong username and password and hit login button page gets posted back and the post method validates the credential and inject validation message (invalid credential) to ErrorMessage property of loginmodel.

So as the login part re-rendered the value of ErrorMessage property is lost.

So please guide us how we can return updated model from driver. Being first time user of widget system we may missed on some point.

Yes, you will need to do a TryUpdateModel in the overloaded Editor method of your driver and pass in a new instance of your LoginModel. If model validation fails, you simply use the LoginModel instance and set it to the property on your part. Should work
like a charm.

Sorry for the delay, I was busy with other stuff could not make time to look into this.

If my understanding is correct, the Editor method is for editor template i.e. when we modify/add information in editor template and save it then we need to update the model, which is already implemented (as a sample) and working fine.

But our requirement is that we are updating the LoginModel in Login controller if the validation fails and the same should be bound to the part while re-rendering. So, that the error message is displayed in UI.

I'm afraid I I'm not sure what the issue is nor what you're trying to do exactly. It looks like you implemented a LoginPart, attached it to a content type (I'll assume you called it something like LoginPage). Now when a LoginPage is rendered, it posts back
to a LoginController. That LoginController is responsible for validating the credentials.

A few questions & remarks:

How will the LoginController know what content item to render if validation fails?

Once you know which content item to render, before you actually invoke BuildDisplay on it, you could set a Boolean flag using WorkContext.SetState or on the HttpContext.Items collection, so that your driver can check that value whether or not to display
an error message. That way you don't have to duplicate login validation (which I assume you will have to do if you were planning to update the view model both on the controller and the driver?)