Scenario :
When you have a survey form with multiple question, and options using radio button. Then you will face the problem, the validation message only the first question will be shown.
The reason caused by Microsoft design,
Here is the solution, to set the particular property name after you call the GetUnobtrusiveValidationAttributes function.
htmlHelper.ViewContext.FormContext.RenderedField(htmlHelper.ViewData.TemplateInfo.GetFullHtmlFieldName(optionExpText), false);
Reference : https://msdn.microsoft.com/en-us/library/system.web.mvc.htmlhelper.getunobtrusivevalidationattributes(v=vs.118).aspx
沒有留言:
張貼留言