|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Prerender changes get lost after Page.RenderControlsnippet below. In one of my datagrids, I reformat some rows in the datagrid's Prerender event. The code behind of the page displays the page and sends the email. The page displays fine however the email has the same look and everything *except* the changes that were made in the grid's prerender. I think I am missing something and was wondering why the changes were lost. I am thinking it's a timing issue. How can I get Page.RenderControl() to execute the prerender event, wait till it's done and continue to the next statement. Code sample: sw = new StringWriter(); htw = new HtmlTextWriter(sw); Page.RenderControl(htw); . . Message.Body = sw.ToString(); private void mygrid_PreRender(object sender, EventArgs e) { some some formating on the grid } Where is your code being run? If you are executing your page code other
than in the page Prerender event, the page would not have called all its child controls' prerender methods. If you stpe through your code, just breakpoint every method and see the order in which the methods run. Or you can do it in your prerender handler for the datagrid. -- Show quoteHide quote---- 700cb Development, Inc. http://www.700cb.net ..NET utilities, developer tools, and enterprise solutions nospam@nospam.sss (John Dalberg) wrote in news:20060113212126.521$9O@newsreader.com: > I am trying to send a webpage with datagrids as an email so I use the > code snippet below. In one of my datagrids, I reformat some rows in > the datagrid's Prerender event. The code behind of the page displays > the page and sends the email. The page displays fine however the email > has the same look and everything *except* the changes that were made > in the grid's prerender. I think I am missing something and was > wondering why the changes were lost. I am thinking it's a timing > issue. How can I get Page.RenderControl() to execute the prerender > event, wait till it's done and continue to the next statement. > > > Code sample: > sw = new StringWriter(); > htw = new HtmlTextWriter(sw); > Page.RenderControl(htw); > . > . > Message.Body = sw.ToString(); > > > private void mygrid_PreRender(object sender, EventArgs > e) { > some some formating on the grid > } >
Other interesting topics
Is this static method threadsafe?
Advantages of Static Vs Instance methods? Use validationSummary to display error message in user control Compiler Error: [No relevant source lines] output cache question PLS HELP: Simple adding data to db in ASP.NET 2.0 CompareValidator for dates > than today VWD 2005 Express: "copy web site" creates multiple publishform (2.0) Trap the Maximum request length 403 (Forbidden) Error |
|||||||||||||||||||||||