Featured post
asp.net mvc - Client side validation script is not generated for partial views fetched using AJAX -
i trying setup client side validation using microsoftmvcjqueryvalidation work ajax submitted forms. works fine if partial view rendered directly view. when try fetch on xhr, example show in jquery dialog, client validation javascript not generated output html. ideas?
working code - partial view rendered using html.renderpartial:
view:
<%@ page title="" language="c#" inherits="system.web.mvc.viewpage<dynamic>" %> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <% html.renderpartial("new"); %> </asp:content>
partial view:
<%@ control language="c#" inherits="system.web.mvc.viewusercontrol<product>" %> <% html.enableclientvalidation();%> <% html.beginform();%> <%= html.editfield(m => m.price)%> <%= html.validationmessagefor(m => m.price)%> <% html.endform();%>
not working code - partial view fetched jquery load() function.
view:
<%@ page title="" language="c#" inherits="system.web.mvc.viewpage<dynamic>" %> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> .... $("#dialog").load('~/product/new/'); $("#dialog").dialog("open"); .... <div id="dialog" title=""></div> </asp:content>
relevant controller action:
public partialviewresult new(int id) { return partialview(service.getproduct()); }
thanks.
this happen partial views return javascript inserted dom via ajax. problem javascript returned partial view not executed/interpreted when inserted document.
unfortunately, because dealing generated javascript can explain why experiencing problem i'm @ loss solution. function wrote i'd suggest adding oncomplete. can offer javascript limitation , start looking there.
btw: looks promising http://adammcraventech.wordpress.com/2010/06/11/asp-net-mvc2-ajax-executing-dynamically-loaded-javascript/
- Get link
- X
- Other Apps
Comments
Post a Comment