In an earlier article on 4Guys, Emailing the Rendered Output of an ASP.NET Web Control, I looked at how one could, with just a bit of code, have the contents of a Web control emailed in an HTML-formatted email to a specified recipient. Below is a screenshot of a DataGrid emailed to myself using the code I discussed in the previous article. Practical uses for emailing the rendered contents of a data Web control might be to send a user's shopping cart, or send an online invoice, or any other number of features where the data is presented in a data Web control and the user wants some form of an email receipt.

Since the article's inception, I have received a few emails from alert 4Guys readers saying that if the DataGrid has a ButtonColumn (or an EditCommandColumn, or a TemplateColumn with LinkButtons or Buttons), that attempting to render the DataGrid results in an error. This occurs because when the DataGrid's control hierarchy contains a Button or LinkButton, when this Button or LinkButton is rendered, the Page.VerifyRenderingInServerForm() method is called. This method checks to ensure that rendering of a server form has started before the control is rendered.
Now, the challenge I propose to you, the six people who read my blog, is: “How can this be overcome so that an email can be sent?” I have already thought of a couple of ways, and ASP.NET server control God Andy Smith has also provided some suggestions... but I'm interested to see what ideas others can come up with. Both mine and Andy's ways feel like hacks. I'll be happy to share them soon enough (in the form of an upcoming 4Guys article nonetheless), but am interested in alternative approaches. (Rather than take the time to share Andy's approach and my approaches, I'd rather just let those who care to respond to free-think on their own...)