G
Guest
Can anyone please show me what the VB would look like to get CheckBoxList
form results into a oMessage.Body for sending in email?
This is an example of my CheckBoxList:
<asp:CheckBoxList ID="ckbThings" runat="server">
<asp:ListItem Value="Thing 1">Thing 1</asp:ListItem>
<asp:ListItem Value="Thing 2">Thing 2</asp:ListItem>
<asp:ListItem Value="Thing 3">Thing 3</asp:ListItem>
</asp:CheckBoxList>
I have the following code already (where ????????? is what I can't figure
out). I suspect I need another Dim, but how does it all come together?:
<script language="vb" runat="server">
Sub btnSendEmail_OnClick(sender As Object, e As EventArgs)
Dim sBody1, sBody2
sBody1 = "My name is: " & txtName.Text
sBody2 = "I chose these things: " ?????????????
Dim oMessage As New MailMessage
oMessage.To = "(e-mail address removed)"
oMessage.From = "(e-mail address removed)"
oMessage.Subject = "Things selected"
oMessage.Body = sBody1 & vbCrLf & sBody2
SmtpMail.Send(oMessage)
Response.Redirect("thankyou.aspx")
End Sub
</script>
Thank you!
form results into a oMessage.Body for sending in email?
This is an example of my CheckBoxList:
<asp:CheckBoxList ID="ckbThings" runat="server">
<asp:ListItem Value="Thing 1">Thing 1</asp:ListItem>
<asp:ListItem Value="Thing 2">Thing 2</asp:ListItem>
<asp:ListItem Value="Thing 3">Thing 3</asp:ListItem>
</asp:CheckBoxList>
I have the following code already (where ????????? is what I can't figure
out). I suspect I need another Dim, but how does it all come together?:
<script language="vb" runat="server">
Sub btnSendEmail_OnClick(sender As Object, e As EventArgs)
Dim sBody1, sBody2
sBody1 = "My name is: " & txtName.Text
sBody2 = "I chose these things: " ?????????????
Dim oMessage As New MailMessage
oMessage.To = "(e-mail address removed)"
oMessage.From = "(e-mail address removed)"
oMessage.Subject = "Things selected"
oMessage.Body = sBody1 & vbCrLf & sBody2
SmtpMail.Send(oMessage)
Response.Redirect("thankyou.aspx")
End Sub
</script>
Thank you!