Asp.net - Access Final Rendered Html Of Formview Control
Solution 1:
I found a simple solution to what I was looking for via this answer:
https://stackoverflow.com/a/17058409/363892
Basically I had to override the VerifyRederingInServerForm
method to bypass verification that the control was contained within a <form ... runat="server">
when invoking fvwWhseDetails.Rendercontrol(w);
.
Additionally, I had to disable event validation via setting <%@ Page ............ EnableEventValidation="false" %>
on the page to allow the FormView control to be rendered independently.
I don't fully understand the implications of bypassing both of these safeguards, but since this page is only used to return this single FormView control, I'm going to go forward with solution for now. If anyone has a more appropriate solution, please feel free to contribute and I will change my answer accordingly.
Solution 2:
If you wrap your FormView in a user control, you could define an HttpHandler (myFormView.ashx) which could load just that control, render, and respond with the generated HTML.
See http://madskristensen.net/post/load-user-controls-from-an-httphandler-in-aspnet to get yourself started.
Post a Comment for "Asp.net - Access Final Rendered Html Of Formview Control"