There is an ASP.NET page that searches my database and inserts the results in a RepeaterList. The page is rendered for me, but I need to save the content that has been rendered into a variable. The user should be able to send the rendered content in an e-mail by clicking a button. How do I do this?
-
You want to send the entire page as an HTML e-mail? Do I understand you correctly?jwheron– jwheron2011-10-20 19:38:33 +00:00Commented Oct 20, 2011 at 19:38
-
yeah, is it! i want to get html to inser in my email body!mcamara– mcamara2011-10-20 19:44:44 +00:00Commented Oct 20, 2011 at 19:44
-
Couldn't you use jquery and essentially assign the html content to a variable that can be passed around?Gjohn– Gjohn2011-10-20 19:44:56 +00:00Commented Oct 20, 2011 at 19:44
Add a comment
|
2 Answers
If you want to email the HTML contents of the repeater, you can do something like this:
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
Repeater1.RenderControl(oHtmlTextWriter);
string repeaterHtml = oStringWriter.ToString();
Comments
Probably the quickest way I've done so would be to do a postback on the email button, override Render and send your email there if the button had been clicked.