September 16, 2008 at 8:37 am
Hi. Using the wizard tool from MS Visual Web Developer 2008 I have added various steps to allow users to enter information via a 'Support' web page. The information entered is sent via email. I have the form working OK but not as required. I wizard uses 3 steps:
1) Contact Info (Name / Email / Issue / Rating)
2) Summary (this page displays a summary of the values entered in step 1)
3) Complete (user hits finish and redirected to url)
The code behind the page is as follows:
Imports System.Net.Mail
Partial Class contact_contact
Inherits System.Web.UI.Page
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
Sendmail(txtEmail.Text, txtName.Text)
End Sub
Private Sub Sendmail(ByVal from As String, ByVal body As String)
Dim mailservername As String = "my-server.mydomain.com"
Dim message As MailMessage = New MailMessage(from, "address@domain.com", "", body)
Dim mailclient As SmtpClient = New SmtpClient
mailClient.Host = mailServerName
mailClient.Send(message)
message.Dispose()
End Sub
End Class
The above sends email. The body of the email currently contains the value entered in the txtName field (as that's all I had to go on!).
I would like the body of the email to contain all the data entered in step 1 or the data displayed within the Summary?
Can any of you .NET gurus assist?
Many Thanks,
Phil.
-------------------------------------------------------------------------------------
A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."
Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '
Tommy Cooper
September 16, 2008 at 8:46 am
Hi Phil,
How is the summary displayed? Is it in one big textbox or another control?
You may, if the summary is on a different form rather than CSS layer, need to pass the content of that control in a variable to the next page.
September 16, 2008 at 12:17 pm
Hi Adrian. I have attached the code behind the page.
Basically the summary takes is values from the values entered in Step 1 of the wizard. I have attached separate code.
I hope that it all makes sense!! I am no programmer learning on the fly 🙂
Thanks,
Phil.
-------------------------------------------------------------------------------------
A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."
Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '
Tommy Cooper
September 16, 2008 at 12:47 pm
The same way I'm learning it. In at the deep end, who needs armbands?!? :crazy:
I think you should be able to concatenate your fields together in your Click method like this:
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
Dim concatSummary as String
concatSummary = ""
concatSummary = concatSummary & "Name: " & txtName.Text & CHR(13) & CHR(10)
concatSummary = concatSummary & "Email: " & txtEmail.Text & CHR(13) & CHR(10)
concatSummary = concatSummary & "Issue: " & DDListIssue.SelectedValue & CHR(13) & CHR(10)
concatSummary = concatSummary & "Rating: " & DDListRating.SelectedValue) & CHR(13) & CHR(10)
Sendmail(txtEmail.Text, conCatSummary)
End Sub
Hth (and hope it works too!),
September 16, 2008 at 1:59 pm
Adrian thanks for that. I am out of the office tomorrow I will give that a try on Thursday then post back.
Thanks,
Phil.
-------------------------------------------------------------------------------------
A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."
Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '
Tommy Cooper
September 16, 2008 at 2:26 pm
Hi Adrian, I could not wait so have implemented remotely and it works a treat.
Next challenge(s) for the intranet:
1) Add site map
2) Add functionality to the contact form to allow file uploads which are then sent as attachments
Many thanks for your help,
Phil.
-------------------------------------------------------------------------------------
A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."
Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '
Tommy Cooper
September 16, 2008 at 2:43 pm
September 16, 2008 at 2:58 pm
Thanks Adrian. Any ideas why .aspx pages take a while to render when called initially? PHP, HTML nice and quick, aspx not that good?
I read this http://www.aspnetresources.com/articles/debug_code_in_production.aspx
Have you experianced this?
Thanks,
Phil
-------------------------------------------------------------------------------------
A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."
Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '
Tommy Cooper
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply