Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Window > Client validation not working with window loaded from form
Telerik MVC Extensions are no longer supported (see this page for reference). In case you have inquiries about Kendo UI Complete for ASP.NET MVC, post them in the pertinent Kendo UI forums.

Not answered Client validation not working with window loaded from form

Feed from this thread
  • Aaron avatar

    Posted on Feb 1, 2012 (permalink)

    I have been able to get the examples provided in previous posts on client validation in windows to work, but really do not like the solution.   Having to paste in all of the form content into the Content() method is not a good solution and with large pages is going to make for some very messy code.  For example:

     

        <% Html.Telerik().Window() 
               .Name("Window") 
               .Modal(true) 
               .Content(() => 
                
                    %> 
                        <% using (Html.BeginForm()) {%> 
                            <%: Html.ValidationSummary(true) %> 
                
                            <fieldset
    ... form content here....

    It would be much cleaner to use a solution like this where we can keep the form inside another page:

    <% Html.Telerik().Window() 
           .Name("Window") 
           .Modal(true) 
           .LoadContentFrom("/Home/Popup/")  
           .Visible(true) 
           .Render(); 
     %>
    ..or even a partial view:
    <% Html.Telerik().Window() 
           .Name("Window") 
           .Modal(true) 
           .Content("<div>... render partial view here....</div>") 
           .Visible(true) 
           .Render(); 
     %>

    When I try the last two methods, the windows load great, but the client validation doesn't run.  If I go to /Home/Popup/ directly (outside of the windows load) the client validation works.   But, the minute I launch it inside the window using one of these methods, the client validation doesn't fire.   The validation client logic is injected properly into the page, but it just doesn't ever fire.

    I have attached an updated version of the clientvalidation project that was posted here late last year.  /Home/SinglePage/ demonstrates how the client validation does work when the entire form is in the content method.  /Home/Index/ demonstrates how the client validation doesnt work when the form is loaded into the window.

    FYI - the reason we are trying to do this is that we have a very large app with over 60 entities (code tables) that users can customize for their company.  We are setting this up with a tree view in the left pane of a splitter, with the grid attached to each entity displayed in the right pane.  We would like to put a CREATE NEW button on the grid and have it open into a new window in case a user wants to add a new row.  This was easy to do in ASP.Net with the RadWindow, but has been a real pain with MVC. 

    Attached files

  • Aaron avatar

    Posted on Feb 2, 2012 (permalink)

    We were able to finally get this to work by putting the scripts inside the partial views also.  We have them in the layout pages, and they are showing up in the final rendered page (with the window in it), but they only fire when they are also added to the partial views:

     

    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Window > Client validation not working with window loaded from form
Related resources for "Client validation not working with window loaded from form"

ASP.NET MVC Window Features  |  Documentation  |  Demos  |  Telerik TV ]