i am new to mvc. i have just encountered a problem. I have created a prtial view which has a texbox in it, which is bind to a property in a model. on that property [Required] validation has applied. the problem is that when i render that partial view multiple times on a view and clik the submit buttion after filling data only in one text box, validation applies on all partial views at the same time. What i want is that [Required] Validation should apply on all partial views/TextBoxes seperately.
My partial View is
@Html.TextboxFor(m=>m.Name)
Model is
[Required]
public string Name(get; set;}
My view has multiple partial views
@Html.Partial(_MyPartialView)
@Html.Partial(_MyPartialView)
<input Type="submit" value="click"/>
when i fill data on first partial then validation automatically apply on second partial view too at the same time.
Hope you guys will understand the preoblme. I will be really thankfull if any one can help as i am stuck for several days for this issue. Many thanks in advance.