lundi 2 novembre 2015

Validate dynamic textboxs in mvc in client side and server side

I need to add dynamic text boxes in mvc view and validate it in client side and in server side .Usually we make property in model and set annotation for required and max length then set text box field with same name of this property in view but How to make dynamic properties with dynamic annotations for dynamic generated text boxes ?or how to validate dynamic generated field in server side and in client side ? .I searched a lot but i didn't find any powerful solution to my issue i tried this code to make validation in client side

         $('#NameT').rules('add', { required: true, messages: { required: 'The Foo field is required' } });

but this validation canceled other validations in same view (i mean other validation for static fields because my view contains static and dynamic fields static field i validate it in model by set annotations)

Aucun commentaire:

Enregistrer un commentaire