Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

Validation metadata problem in MVC3 R2 with class inheritance

Posted: Dec/14/2010   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:251   Vote Up (0)   Vote Down (0)    

HI

My project upgrade to MVC3 R2, but there is a problem with validation metadata when the model inherit from other class.  In MVC2 all the child class will inherit the validation metadata, but in MVC3 R2, it will be not include the validation metadata of parent class. Is this expected?

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

Password strength validation with JQuery using asp.net MVC

  

 hi, is it possible to use a Jquery in an .net MVC project?? i just want to ask wants wrong with may codes it wont work. I'm working on registration, I add a password strength in my password fields. It shows no error but it wont display any password strength.  Heres what i have in my View code

 

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Reg_Register</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript" src="../../Scripts/jquery.js"></script>
<script type="text/javascript" src="../../Scripts/digitalspaghetti.password.js"></script>

<script type="text/javascript">
    $j("#Password").pstrength({ minChar: 6, one_number: true, one_special_char: true,
        verdicts: ['Weak', 'Normal', 'Strong', 'Very Strong'], colors: ["red", "orange", "#00cc00"]
    });
</script>
    
    <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>

    <% using (Html.BeginForm()) {%>

        <fieldset>
            <legend>Registration Information</legend>
            <p>
                <label for="Name">Name:</label>
                <%= Html.TextBox("Name") %>
                <%= Html.ValidationMessage("Name", "*") %>
            </p>
            <p>
                <label for="Address">Address:</label>
                <%= Html.TextBox("Address") %>
                <%= Html.ValidationMessage("Address", "*") %>
            </p>
            <p>
                <label for="Email">Email:</label>
                <%= Html.TextBox("Email") %>
                <%= Html.ValidationMessage("Email", "*") %>
            </p>
            <p>
                <label for="Username">Username:</label>
                <%= Html.TextBox("Username") %>
                <%= Html.ValidationMessage("Username", "*") %>
            </p>
            <p>
                <label for="Password">Password:</label>
                <%= Html.Password("Password")%>
                <%= Html.ValidationMessage("Password", "*")%>
            </p>
            <p>
       

problem in outlook

  

hello i am facing a problem in microsort outlook 2003.

i have an email template in html in which i am sending data from asp.net page and according to condition making display:none of sm <tr> dymamically.

it is working fine when received in outlook. but when we press forward button to forward mail

then hidden rows also displays.

Any idea to get rid of this problem.

Please suggest me



jquery Input validation

  

Hello

I am trying to validate dynamically created text inputs. I have been following tutorials about how to do jquery validation using the validation library, but I cannot seem to get this to work.

Can anyone help me out? Maybe post a few examples of validation you have done?


Heres the code where I generate the inputs.


var html = "<label name='NewScreenLabel' for=' " + this.ResourceText + "'>" + this.ResourceText + ":" + "</label><input type='text' class='screeningInput'  id='" + this.ScreeningPropertyID + "' /><br />";
                        $("#NewScreeningWrapper").append(html);




Strange problem with a button in a repeater

  

I've got a Imagebutton in a repeater.
Code:

<asp:Repeater ID="repImages"  runat="server">
                    <ItemTemplate>                       
                        <div>
                            <div><asp:ImageButton ID="btnDeleteImage" Width="7" Height="7" runat="server" AlternateText="Verwijder afbeelding"  OnClientClick="return confirm('Weet u zeker dat u deze afbeelding wil verwijderen?');" OnClick="ImageButton_OnClick" ImageUrl="~/images/spacer.gif" /></div>
                            <img id="imgImage" runat="server" src='<%# GetOccasionPath(int.Parse(Eval("ID").ToString()),Eval("BaseFileName").ToString(), TypeImage.thumbnail) %>' />
                        </div>
                    </ItemTemplate>
                </asp:Repeater> 

 

It is displayed well, but if i press the button btnDeleteImage he doesn't even run ImageButton_OnClick , also there is no data included just for testing...
protected void ImageButton_OnClick(object source, EventArgs e)
    {
       
    }

 

But still i get this error:

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Also enableEventValidation="true" is placed in the page.
What can i do to solve this?


WC3 Validation with Viewstate - and favicon - VS2010

  

Hi

I've been though this once before, but somehow can't get these two items to run correctly (VS2010 - Server 2008 R2 - .NET4.0)

WC3 Validation

I have entered (in Web.config)

<xhtmlConformance mode="Strict"/>

But it still fails validation for the viewstate

 

Favicon

I have entered (inbetween head)

 <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> 


and the favicon is displayed in the browser tab when run locally, but not when published!

 

Any ideas?

 

Thanks


 

 

 

 


SVN problem

  

Hello

I am using Visual SVN Server and Tortoise SVN as a Client. 

After I get update and ascx file is merged visual sdutio displays warning and I must set merged file line encoding.

The line endings in the following file are not consistent. Do you want to normalize line endings?


I believe that it's due to default SVN merge tool or visual svn behaviour for currently opened files. 



Exporting DataSet to Excel in asp.net problem

  

Hi,

      I'm trying to export a dataset to excel directly. I'm repeating, it's a dataset to excel (NOT DATA GRID OR GRID VIEW TO EXCEL). The problem I face is formatting. I'm exporting the excel which has aroung 13 columns.

    A column should be in dd/MM/yyyy 00:00:00 format. Time will always be 00:00:00. It is exporting in correct format only, but for example when the date is Jan 05, 2010, when it comes from database it shows correct format as 05/01/2010 00:00:00. When it binds, it binds as 5/1/2010 00:00 which is not suppose to happen.

 And the other problem is with the decimal formatting. I need 2 decimal places at the last. In c# code, I'm converting to decimal with 2 decimal places, but when it binds, it won't happen. I tried inserting a ' (colon) before the text is entered, but the cell is not converted into a text field Foot in mouth

   Can anyone give me a solution for this?


Problem on DateTime class

  

i tried to get current date and time using


              DateTime dtCurrTime = DateTime.Today;


            //string d
            Label1.Text = dtCurrTime.ToString();

            //DateTime dt = DateTime.Now.Hour;

            Label2.Text = DateTime.Now.Date.ToString();




 i'm getting the date correct but time is always getting default value


12/15/2010 12:00:00 AM


grid view without any data source date sorting problem

  

i grid view contain the following coloum

id    name         DateofBirth                  DateofJoining 

1       a            22-Aug-1980                      10-jan-2000

1       a            22-may-1980                      20-feb-2000

1       a            12-Feb-1980                      15-mar-2000

1       a            3-Aug-1980                      7-jan-2000

how to sort if we click   DateofBirth or Dateofjoining and not sort any where if we click(Id,Name)


Problem with Server.Transfer in IE

  

I have the following code:

Protected Sub btnAdmin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Server.Transfer("~/Admin/Default.aspx")
End Sub

that runs when a user clicks the admin button

It works fine in firefox, but in IE it doesn't work.
 


 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge