I am using the standard .NET method of sending an email. My users will
be filling out a web form with various pieces of information. I have
created a control with properties that are the same as the items on
the form. When the user clicks submit, my code is as follows:
InformationRequ est req = new InformationRequ est();
req.FirstName = this.txtFirstNa me.Text;
req.LastName = this.txtLastNam e.Text;
req.Title = this.txtTitle.T ext;
req.Address1 = this.txtAddress 1.Text;
req.Address2 = this.txtAddress 2.Text;
req.City = this.txtCity.Te xt;
req.State = this.cboState.S electedItem.Val ue;
req.Zip = this.txtZIP.Tex t;
req.Phone = this.txtPhone.T ext;
req.Fax = this.txtFax.Tex t;
System.Text.Str ingBuilder sb = new System.Text.Str ingBuilder();
System.IO.Strin gWriter sw = new System.IO.Strin gWriter(sb);
System.Web.UI.H tmlTextWriter writer = new HtmlTextWriter( sw);
req.RenderContr ol(writer);
SmtpMail.SmtpSe rver = "192.168.0. 10";
SmtpMail.Send(F rom, To, Subject, sb.ToString());
//End of code
When I send the email, it comes through, but there is no message body.
In addition, if I try to Response.Write the contents of the
stringbuilder, there isn't anything there. What is causing the control
not to render? All the control contains is a bit of HTML code and <%
%> blocks where it reads from its properties.
Any ideas?
Thanks,
Will Gant
Fo*******@hotma il.com