This is a migrated thread and some comments may be shown as answers.

[Solved] Client Validation not working on LoadFromContent tab

2 Answers 195 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joan Vilariño
Top achievements
Rank 2
Joan Vilariño asked on 23 Apr 2010, 10:50 AM
Hello...

I have a form with several tabs where the user inputs data. That tabs are loaded with LoadFromContent from .ascx fiels. Most of the properties inside that tabs have associated DataAnnotation validations.

The main "Edit" .aspx looks something like this:

<% using (Html.BeginForm()) {%> 
    <% Html.EnableClientValidation(); %> 
    <% Html.RenderPartial("EditarCabecera", Model); %> 
<div style="width: 100%; min-width:1000px"
    <%=Html.HiddenFor(o => o.VMLocal.Id) %> 
    <%= Html.Telerik().TabStrip() 
        .Name("tabStripEditar") 
        .Effects(effects => effects.Opacity().OpenDuration(150).CloseDuration(150)) 
        .Items(items => 
                   { 
                       items.Add().Text("Datos Local").LoadContentFrom("_editarDatosLocal", "Local").Selected(true); 
                       items.Add().Text("Centros de Servicio").LoadContentFrom("_editarCentrosServicio", "Local"); 
                       items.Add().Text("Explotación").LoadContentFrom("_editarExplotacion", "Local"); 
                       items.Add().Text("Plazas").LoadContentFrom("_editarPlazas", "Local"); 
                       items.Add().Text("Italia").LoadContentFrom("_editarDatosItalia", "Local"); 
                       items.Add().Text("CaracterĆ­sticas").LoadContentFrom("_editarCaracteristicas", "Local"); 
                       items.Add().Text("Observaciones").LoadContentFrom("_editarObservaciones", "Local"); 
                       
                   })%> 
     
     <% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group 
                                                              .Add("jquery.validate.js") 
                                                              .Add("telerik.common.js") 
                                                              .Add("telerik.draganddrop.js") 
                                                              .Add("telerik.grid.js") 
                                                              .Add("telerik.grid.filtering.js") 
                                                              .Add("telerik.grid.editing.js") 
                                                              .Add("telerik.calendar.js") 
                                                              .Add("telerik.grid.grouping.js") 
                                                              .Add("telerik.datepicker.js")); %>                    
</div>       
<div id="divBotonera"
        <input type="submit" value="Guardar" /> 
        <%= Html.ActionButton("Volver a la lista", "Index") %> 
</div>         
 <% } %>  

As you can see most of the content of the form is loaded using LoadFromContent, but at Submit time, no validator is working on client.

Is there something special I have to do?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 23 Apr 2010, 12:16 PM
Hi Joan VilariƱo,

Unfortunately the MS client validation is not supported, when partial view is used. The cause of this behavior is the inability of the MS MVC Ajax to evaluate the javascript and CSS. Hence the required client validation rules, defined by DataAnnotations, will never be serialized. Thus the MS MVC client validation will never work.
You can use .Content method to render all HTML at once.

Regards,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
raymond
Top achievements
Rank 1
answered on 15 Feb 2011, 08:52 AM
Does this work with mvc3?
Because Microsoft is now using jquery for everyting instead of mvc ajax.
Tags
TabStrip
Asked by
Joan Vilariño
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
raymond
Top achievements
Rank 1
Share this question
or