This is a migrated thread and some comments may be shown as answers.

ASP.NET MVC Html.ValidationMessage in EditItemTemplate

2 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 26 Nov 2008, 10:58 AM
I have followed Vladimir Enchev's example of using the RadGrid within the ASP.NET MVC Framework.
I have got my grid working, except for validation in the EditItemTemplate (which is not part of the example).

I am using ModelState.AddModelError to add errors to the model state,
but i cannot seem to obtain these values in the view (using Html.ValidationMessage).
What am I doing wrong?
Has anyone got this working?

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 01 Dec 2008, 01:48 PM
Hello Dennis,

I've modified the example you pointed us from your previous post to use ASP.NET MVC Beta. You can find it attached to this thread. If you attempt to "Update" item in RadGrid error will be thrown in HomeController.Update method and in Index view  error will be shown by Html.ValidationMessage.

Please find the application and review the code.
I hope this is helpful.

Kind regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dennis
Top achievements
Rank 1
answered on 01 Dec 2008, 03:13 PM
Hi, thanks for the reply.

It turned out my problems with validation had nothing to do with RadGrid, but was a problem related to RedirectToAction, and passing temp data between actions.
Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Dennis
Top achievements
Rank 1
Share this question
or