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

Will you providing a Validation framework for ASP.NET MVC?

11 Answers 180 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Will Huang
Top achievements
Rank 2
Will Huang asked on 03 Feb 2009, 03:02 PM
The ASP.NET MVC validation framework are weak.  Are you plan to providing a Validation framework for ASP.NET MVC?

11 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 05 Feb 2009, 08:28 AM
Hello Will Huang,

We do not yet have any plans for a Validation framework specifically for ASP.NET MVC but you can use RadInput and RadInputManager to greatly simplify the validation.

Kind regards,
Ivo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Wei
Top achievements
Rank 1
answered on 10 Feb 2009, 03:52 PM
If you want strong validation I recommend Microsoft Enterprise Framework Validation Block.
http://msdn.microsoft.com/en-us/library/cc467894.aspx

http://msdn.microsoft.com/en-us/library/dd140088.aspx
0
John Brahy
Top achievements
Rank 1
answered on 03 Jun 2009, 06:05 PM
You might want to check out MVCContrib as well, including xVal.
0
GrZeCh
Top achievements
Rank 2
answered on 05 Jun 2009, 07:07 PM
0
Timothy Fischer
Top achievements
Rank 1
answered on 10 Jun 2009, 05:37 PM
Ran into xVal in my searches and like how it works; however, how does one go about adding the attributes to the model such that they are not overwritten during a regen?

Am I missing something?

Even better ->  is it possible to modify the Output from OpenAccess to include necessary attributes for validation?
0
Dimitar Kapitanov
Telerik team
answered on 11 Jun 2009, 11:42 AM
Hi Timothy Fischer,
Currently OpenAccess does not posses any means of validation framework, neither it suports such for Asp.net MVC. Could you share with us your expectations what exactly OpenAccess should do to enhance the support of Asp.net MVC validation? Thanks in advance for the feedback.

Sincerely yours,
Dimitar Kapitanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Timothy Fischer
Top achievements
Rank 1
answered on 11 Jun 2009, 01:14 PM
Dimitar,
 As per the xVal.codeplex.com site, we add the validation code to the Model by putting these types of attrbutes on the properties:

 

 


Here is the example Model:

public class Booking
{
    [Required] [StringLength(15)]
    public string ClientName { get; set; }
 
    [Range(1, 20)]
    public int NumberOfGuests { get; set; }
 
    [Required] [DataType(DataType.Date)]
    public DateTime ArrivalDate { get; set; }
}


Then the xVal library and jQuery allow for handling the validation based on those attributes. The nice thing about it is that via the xVal library, any validation handlers can be used.


*BUT*, those attributes somehow need to be added in the Model.

Perhaps it is possible another way, but I would not know how.

 



Tim
0
Dimitar Kapitanov
Telerik team
answered on 11 Jun 2009, 02:32 PM
Hi Timothy Fischer,
Ok I see your point, though I ‘am unable to give you insight when this will be on our TODO list for OpenAccess. We are definitely considering adding validation logic to the O/R tool.


Kind regards,
Dimitar Kapitanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mac
Top achievements
Rank 2
answered on 04 Aug 2009, 11:28 PM
Another +1 for xVal and DataAnnotations. It's nice and clean and 'it just works'

I've also asked the question about validation in OpenAccess but it seems there are no plans for it yet but there are a couple of current options, one is to use the metadata attribute against your generated partial classes, the other is modifying the OpenAccess templates, more details here - http://www.telerik.com/community/forums/orm/general-discussions/dataannotations.aspx 

Hope that helps.
Mac.
0
Håvard
Top achievements
Rank 1
answered on 28 Sep 2010, 04:15 PM

Hi, this thread is kind of old now so I want to ask if theres been any development on this issue?

Seems its a standard part of mvc2:
http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx

I would like to use this with openaccess though.

(The template solution looked kind of hackish for me so I haven't tried that)

0
Serge
Telerik team
answered on 30 Sep 2010, 05:55 PM
Hello HÃ¥vard,

 The templates you have seen in this thread refer to the ones use with OpenAccess Classic. If you are using the new designer you should have a look at the T4 templates we use for code generation. You will find this blog post and this help article helpful.

I would like to point out that the article you have shared actually uses the so called "buddy classes", which is a technique that you can use with any class and allows you to extend the generated classes with additional attributes. This means that you should not experience any problem in using it with OpenAccess, however it will be your responsibility to add the data annotations as we haven't yet planned such a feature.

I hope this helps and if you experience any trouble please contact us back.

Kind regards,
Serge
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Will Huang
Top achievements
Rank 2
Answers by
Ivo
Telerik team
Wei
Top achievements
Rank 1
John Brahy
Top achievements
Rank 1
GrZeCh
Top achievements
Rank 2
Timothy Fischer
Top achievements
Rank 1
Dimitar Kapitanov
Telerik team
Mac
Top achievements
Rank 2
Håvard
Top achievements
Rank 1
Serge
Telerik team
Share this question
or