jquery - ASP.NET - Access final rendered HTML of FormView control -


i trying use separate webpage generate html can returned via ajax webpage update panel. however, cannot find way access rendered html return via response.write(...).

my webpage code follows:

<%@ page language="c#" autoeventwireup="true" codefile="warehousedetails.aspx.cs" inherits="warehousedetails" %>  <!doctype html>  <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="frmmain" runat="server">         <div id="content" runat="server">         <asp:formview id="fvwwhsedetails" runat="server" allowpaging="false" renderoutertable="false">             <itemtemplate>                 <div class="col-md-8"><asp:textbox id="txtitemnum" runat="server" cssclass="form-control" text='<%# eval("ordercode") %>' disabled/></div>                 ....                 ....                 ....             </itemtemplate>         </asp:formview>         </div>    </form> </body> </html> 

after page loaded, renders html similar following:

<html xmlns="http://www.w3.org/1999/xhtml"> <head><title>  </title></head> <body>     <form method="post" action="warehousedetails.aspx" id="frmmain">         <div id="content">             <div class="col-md-8"><input name="fvwwhsedetails$txtitemnum" type="text" value="159580" id="fvwwhsedetails_txtitemnum" class="form-control" disabled="" /></div>             ....             ....             ....         </div>     </form> </body> </html> 

what trying accomplish returning of rendered html contained withing ... area. however, nothing have tried seems work.

in code-behind file, have tried following methods html retrieval respective errors commented below each method:

public partial class warehousedetails : system.web.ui.page {     protected string stroraconnectionstring = configurationmanager.connectionstrings["oraconnectionstring"].connectionstring;      protected void page_load(object sender, eventargs e)     {         string strselect = @"...";          using (oledbconnection orahqdb = new oledbconnection(stroraconnectionstring))         {              oledbcommand command = new oledbcommand(strselect, orahqdb);             orahqdb.open();              oledbdatareader reader = command.executereader();             if(reader.hasrows)             {                 fvwwhsedetails.datasource = reader;                 fvwwhsedetails.databind();                  // until point works fine.                 // if code below excluded,                 // page renders correctly.                  string resp;                  // method 1 - try access innerhtml of <div id="content">...</div>                 system.web.ui.htmlcontrols.htmlgenericcontrol div = (system.web.ui.htmlcontrols.htmlgenericcontrol)frmmain.findcontrol("content");                 string resp = div.innerhtml;                 // error generated:                 //    system.web.httpexception:                 //    cannot inner content because contents not literal.                  // method 2 - try use rendercontrol()                 stringwriter sw = new stringwriter();                 htmltextwriter w = new htmltextwriter(sw);                 frmmain.rendercontrol(w);                 fvwwhsedetails.rendercontrol(w);                 fvwwhsedetails.row.rendercontrol(w);                                     div.rendercontrol(w);                 resp = sw.getstringbuilder().tostring();                 // error generated:                  //    system.web.httpexception:                 //    control '[control]' of type '[type]' must placed inside form tag runat=server.                  response.write(resp);             }             else             {                 response.write("no results found.");             }             response.end();             reader.close();         }     } } 

i've searched repeatedly , tried wrapping content in various containers , server controls, regardless end @ 1 of 2 errors listed above.

what proper way access rendered html within formview?

if wrap formview in user control, define httphandler (myformview.ashx) load control, render, , respond generated html.

see http://madskristensen.net/post/load-user-controls-from-an-httphandler-in-aspnet started.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -