.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Metadata buddy class validation issue

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :ASP.Net

I accidentally duplicated the thread and I found no way to delete one of them.

Please, follow the thread here: http://forums.asp.net/t/1614475.aspx




I am using asp.net MVC 2 and Entity Framework 4. I followed the directions to annotate my model classes through a buddy metadata class, so annotations are not lost when EF classes are generated.

It worked fine for a simple class, but now I am working on a more complex class, that requires regular expression and range validation for double type values.

It seems that for this class, MVC is finding the annotation to display the label (I changed the annotation and I saw it changed on my browser), but as far as the validation annotations, it is ignoring it completely.

Any idea before I try something crazy, like downloading the mvc source, and debugging the framework myself?



View Complete Post

More Related Resource Links

How to get validation to work for buddy class in 2 screens


I have set up my buddy class with validators. However I only want the validators to fire of the associated fields are used in that particular screen. When I split them across 2 screens I find my validation doesn't work. How do I fix this? I have had to remove the validation from some properties in order to get it to work on one screen;

See the class here;

        #region "Buddy class" for validation
        /// <summary>
        /// This "buddy class" provides validation for a class generated from EF
        /// </summary>
        private sealed class Metadata

User validation Issue in xlsx file



I am validating user from Login.xlsx file. It was working fine by validating email and password from that file. For testing i got new file same contents of file but added some more user names.

So after that when i validating the user i am getting the following error "Data type mismatch in criteria expression".

But when i replaced the new to old one it is working fine. The contens of both files are the same. So why this kind of error happened.


Extreme ASP.NET: Model Validation & Metadata in ASP.NET MVC 2


Scott Allen shows how to improve your user input validation with new features coming out in ASP.NET MVC 2 that easily allow validation on both the client and server.

Scott Allen

MSDN Magazine March 2010

XmlReader.Create(textReader, XmlReaderSettings) Validation Issue

For the most part, when I perform an XmlReader.Read() I am catching validation errors based on my schemas.  This, however, is a large group of schemas with several imports and includes.  My question is why I'm having validation errors in two places that seem to be defined in the schema.   Here's an example:   Schema 1 (you can see that IdentificationType has sub-elements for IdentificationID and IdentificationCode):   <xsd:complexType name="IdentificationType">                 <xsd:annotation>                         <xsd:documentation>A data type for a representation of an identity.</xsd:documentation>                         <xsd:appinfo>                                 <i:Base i:namespace="http://niem.gov/niem/structures/2.0" i:name="Object"/>               &nb

XML schema validation issue

In case a particular node is mandatory, the error described is for the next sibling. In case there exists a error for the next sibling as well. That error message is supressed. On resolving the first issue, and running the validation again, the second error is thrown. Is there a way we can set options on the schema validation, so that we can receive both errors at the same time. For example we have a xml with the following nodes <NM101></NM101> <NM102></NM102> <NM103></NM103> Here NM101 is a mandatory node and NM102 has type as integer. In case we receivethe below xml <NM102>ABC</NM102> <NM103>DEF</NM103> Error: The element 'NM1' has invalid child element 'NM102'. List of possible elements expected: 'NM101' But the error for NM102 is now supressed and can be retrieved only when NM101 is present. Is there a way that all errors can be reported at the same time ?Swapnil Kasodekar

Issue with validation using IDataErrorInfo with int range

Hi, I have a textbox which takes only numbers as input. Textbox has binding with int type property. <TextBox Name="TXT_From" Text="{Binding Path=Range, UpdateSourceTrigger=LostFocus,<br/>  ValidatesOnDataErrors=True, Mode=TwoWay}" /> public int Range { get { return (int)GetValue(RangeFromProperty); } set { SetValue(RangeFromProperty, value); } } public static readonly DependencyProperty RangeFromProperty = DependencyProperty.Register("Range", typeof(int), typeof(MyClass)); In IDataErrorInfo I am doing some auto correction of values. public string this[string property] { get { string msg = null; switch (property) { case "Range": if (Range < 0) Range = 1; if (Range > Max) Range = TempMax; break; default: throw new ArgumentException("Unrecognized property: " + property); } return msg; } } Now the issue is when I enter value greater than 2,147,483,647 which is max value for int the IDataErrorInfo member public string this[string property] is not getting called,also it displays red bordered textbox. I want to avoid this validation and dont want restriction on value input. How to achieve this?  

Issue with Alerts with multiple Managed MetaData fields?

i'm seeing an issue in SharePoint 2010 with alerts.  If a list has more than 1 Managed MetaData columns, alerts stop working.  If I take it down to only one managed metadata column, they start working again.  Is this a known issue?  I'm seeing it in multiple sites/mulitple users.

Weird Issue with the MOSS Search : FileExtension metadata object type instead of string

Hello, We 've got a strange issue with the search and especially with the FileExtension metadata. when we make a query on the search engine, we receive for the FileExtension metadata an unexcpected result. here is a printscreen showing the issue. http://cid-53eee937847a625e.photos.live.com/self.aspx/Public/Untitled.jpg as you can see the Type of the FileExtension is object and it should be string and I checked the type of the object and it's System.String[] the element at the index 0 contains the value! what's wrong ? thx in advance

Managed MetaData / Alerts issue

We've found a possible bug with 2010.  I've proven this out in three seperate farms now.  If a library has more than one Managed MetaData column filled in with data, alerts stop functioning on that item.  If I remove all Mgd Meta columns except for one, alerts function again. I applied all available CU/hotfixes (july and august) to one of the farms, but the problem remains. Anyone else seen this?

Issue using Managed Metadata with custom fields in the User Profiles application


Hi there,

I've created several custom properties in my User Profile Application.

I've also created several Term Sets in the Managed Metadata service application Term Store for use with these custom properties. Some of the Term Sets contain terms and have a closed submission policy whilst others have an open submission policy.

If the user hasn't already populated any of these custom fields in their profile, when they click on the Edit My Profile link from their My Site Profile page everything seems okay (for the first time).

The user is then able to successfully select values for these custom fields - the metadata is available. They can click on the "tag" icon to select values, or start typing and the suggestions appear. They are also able to enter new values into custom property fields where the term set is open to submission.

If they then Save and Close then go back into Edit My Profile, often not all of the existing data is populated in the metadata custom fields. On different occasions different fields may be blank. Sometimes this is accompanied by the error "Message from webpage / The server method 'ValidateTerms' failed", but not always.

Has anyone else tried this or have any suggestions are to what the issue might be?

Thanks in advance.

MultiView issue with validation in form


Hi all,

Currently I am working on a user control which has the following "layout":

  • the user control elements are placed inside an Update Panel
  • inside the Update Panel I have a MultiView control with 4 views:
    • first view 2 buttons to select the type of the user to create (clicking one button changes the active view to the second view, clicking the other one activates the third view)
    • second view is for the form used to create a user type
    • third view is for the form used to create the other user type
    • forth view should be used to display the confirmation message for the creation of both user types

In both forms, besides he usual textboxes I am also using validation controls to make sure the data the user inputs is correct.

However, I have a problem in case the data is invalid (the user doesn't input some mandatory field): for a very short period of time I see the * next to the mandatory field and the error in the validation summary, but immediately the active view is switched back to the first view in the MultiView control.

How can I force the control to stay on the view with the selected form?

Any ideas, suggestions or comments are welcomed!

Thank you in advance!


Catch 22 Database Connection Validation Issue w/ BIDS and Production Server


I have a rather simple SSIS package that exports data through an ODBC connection from an IBM iSeries database and copies that data to a SQL Server 2005 database.  When I was designing the application, I was able to connect to the iSeries database and store the user ID and password with my BIDS project and copy the data with out any problems.  Great!

When I finished designing and testing the project, I loaded it to the production server.  The final test was to schedule the process so that it would run each night.  I didn't realize it at the time but the password that I had stored with the project in BIDS was removed from the package and various MS documentation stated that I should create a configuration file and load the password from there.  So, I made the necessary changes to the project, adding a configuration file.  The config file is in the Miscellaneous folder within the BIDS project, however, it isn't automatically copied to the bin directory when I build the project.  I have to manually save it to the server, and then after importing the project I have to manually link to the necessary config fields.

This fixed the problem with the server, however, now I can not get BIDS to save my password with the connection string from within the designer.  This is a huge problem.  I am exporting from 21 different da

jquery validation error message - place in the specified div whose class is putmehere !



I decided to use jquery validations because asp.net validation controls are so crazy inside the update panel.

But I need to plase the error messages in the specified div whose class is putmehere ! I am unable to do that. here is my code;

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <script src="../JQuery/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="../JQuery/Validation/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
                rules: {
                    <%=TextBox1.UniqueID %>: {
                        minlength: 2,
                        required: true
                     <%=TextBox2.UniqueID %>: {                       
                        required: true,
                }, messages: {
                    <%=TextBox1.UniqueID %>:{
                        required: "* Required Field *",
                        minlength: "* Please enter atleast 2 characters *"

Security Validation / Silverlight issue?

When Security Validation is turned off on a 2010 web application, the Silverlight menus break in that web app.  Why is that?  I've seen it across many farms, so I know it's an issue.

MVC 3 Beta - PasswordFor Validation Issue


I have been working with MVC 3 Beta, and things are off to a very good start.

However, I discovered that PasswordFor() is not emitting unobtrusive validation.  I worked around it for now by using TextBoxFor(), and adding type = "password" to the attributes for the textbox.  This gives me a password field, and my unobtrusive validation is emitted.

Is this the correct forum to report MVC 3 Beta issues?



Input-validation-Error issue when Model has complex types



I have implemented aps.net mvc validation and it is working fine. Only issue I have "Input-validation-error" css class is not getting applied if model has complex types.

I am using my own data annotations for validation.

Any idea how to resolve  this.



MetaData Validation needs to live alongside the model it seems


if you use domain service classes you have the option to produce a meta class.  this allows you to add attributes like [Required] etc for simplifying validation.

i have been trying to orgainize my assemblies by splitting out the domain service from the model. 

during that splitting out process i have found that the meta class must reside in the same namespace AND assembly

if they get seperated physically to another project, the code in the meta classes fail to get hit despit being in the same namespace and despite being a partial class.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend