|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Emailing CheckBoxList contentform 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 = "j**@schmoe.com" oMessage.From = "WebF***@company.com" oMessage.Subject = "Things selected" oMessage.Body = sBody1 & vbCrLf & sBody2 SmtpMail.Send(oMessage) Response.Redirect("thankyou.aspx") End Sub </script> Thank you! Something like this:
sBody2 = "I chose these things: " Dim item As ListItem For Each item in ckbThings.Items If item.Selected Then sBody2 = sBody2 & item.Text & ", " Next sBody2 = sBody2.SubString(0, sBody2.Length() -2) Marcie On Fri, 8 Apr 2005 13:43:02 -0700, Gamlyn <Gam***@discussions.microsoft.com> wrote: Show quoteHide quote >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 = "j**@schmoe.com" > oMessage.From = "WebF***@company.com" > oMessage.Subject = "Things selected" > oMessage.Body = sBody1 & vbCrLf & sBody2 > > SmtpMail.Send(oMessage) > Response.Redirect("thankyou.aspx") > > End Sub > </script> > >Thank you! Thank you, it worked like a charm
Show quoteHide quote "Marcie Jones" wrote: > Something like this: > sBody2 = "I chose these things: " > Dim item As ListItem > For Each item in ckbThings.Items > If item.Selected Then sBody2 = sBody2 & item.Text & ", " > Next > sBody2 = sBody2.SubString(0, sBody2.Length() -2) > > Marcie > > On Fri, 8 Apr 2005 13:43:02 -0700, Gamlyn > <Gam***@discussions.microsoft.com> wrote: > > >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 = "j**@schmoe.com" > > oMessage.From = "WebF***@company.com" > > oMessage.Subject = "Things selected" > > oMessage.Body = sBody1 & vbCrLf & sBody2 > > > > SmtpMail.Send(oMessage) > > Response.Redirect("thankyou.aspx") > > > > End Sub > > </script> > > > >Thank you! > >
arraylist copy
How to detect when items are added to Combobox/Listbox Easiest way to generate XML in VB.NET Excaping recursive functions Why do we need Namespace and Module? Possible values of DTE.ActiveDocument.Kind ? How do you force a thread to run on a specific processor? Inheriting forms problem bin folder Validate User |
|||||||||||||||||||||||