my email page code looks like this:-
===========================
you can set an html textbox value the same way you did in ASP.Sub Page_load(Sender as Object, E as EventArgs)
textbox1.text = cstr(session("emailAddress")) 'this works fine
request.form("EmailAddress") = cstr(session("emailAddress")) 'not working :(
If request.form("EmailAddress") = "" Then
dim strResponse as string = "<h2>Send Email using ASP.NET formatted in HTML</h2>"
lblMessage.Text = strResponse
Else
dim strResponse as string = "You just sent an email message formatted in HTML to:<h2>" & request("EmailAddress") & "</h2>"
lblMessage.Text = strResponse
End IfEnd Sub
Sub btn_Click(sender as Object, e as System.EventArgs)
If request.form("EmailAddress") <> ""
Dim mail As New MailMessage
mail.From = "email@dotnet.itags.org.yahoo.com"
mail.To = request.form("EmailAddress")
mail.Subject = "Message sent using ASP.NET and CDONTS"
mail.Body = "HTML Message sent from ASPFree.com using ASP.NET and Cdonts" & "<a href=http://aspfree.com/aspnet/email.aspx>Wonder how this is done?</a>" & "<a href=http://aspfree.com/aspnet/setupcdonts.aspx>Wonder How to setup CDONTS?</a>"
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "19.204.22.166"
SmtpMail.Send(mail)
End If
End Sub
<input type="textbox" value="<%=Session("emailaddress")%"
the server controls give you a great deal of flexibility when building a web page. The code behind makes programming a web page more like programming a windows form. each server control does have overhead however, so if you dont need the extra functionality provided by making the control a runat=server, then you should stick to regular HTML elements.
No comments:
Post a Comment