Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Troubles with jquery ui dialog and save method
Message
 
 
À
03/04/2013 08:40:56
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01569821
Message ID:
01569877
Vues:
28
>AH HA! When you added the constructor, .Net wants to use it everytime. However, when it's created here, there is no constructor that takes no parameters. Create one, and things should start working.
>
>>I think my troubles started when I added this public constructor to the ViewModel. Prior to that at least the Edit method of my controller was being hit. Do you know if I can adjust the ViewModel somehow?
>>
>>I am not sure what do you mean by alert boxes. I can debug the java script in FireFox (FireBug). I see that oForm has some data (it doesn't look like json to me, though).

Good that I looked.

I used

[StringLength(5)]

and I don't know why did I use this instead of MaxLength. I am going to change that and re-try.

Hmm, this should not make a difference

http://stackoverflow.com/questions/5717033/stringlength-vs-maxlength-attributes-asp-net-mvc3-with-ef-4-1-code-first
 [ComplexType]
    public class PhoneInfo
    {
        [DataType(DataType.PhoneNumber)]
        
        [DisplayName("Phone")]
        [RegularExpression(@"^((\(\d{3}\)|\d{3})\s?)?\d{3}[-\s]?\d{4}\s*$", ErrorMessage = "Please enter valid Phone Number")]
        public virtual string Phone { get; set; }

        [StringLength(5)]
        [DisplayName("Ext")]
        public virtual string Ext { get; set; }

        public bool HasValue
        {
            get
            {
                return (Phone != null || Ext != null);
            }
        }

    }
In my view I didn't even touch that field, I only put some data in the Address field. Why would it generate an error?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform