By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,131 Members | 1,072 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,131 IT Pros & Developers. It's quick & easy.

Prerender changes get lost after Page.RenderControl

P: n/a
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);
Jan 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
----
700cb Development, Inc.
http://www.700cb.net
..NET utilities, developer tools,
and enterprise solutions

no****@nospam.sss (John Dalberg) wrote in
news:20*******************@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
}


Mar 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.