【发布时间】:2014-09-16 00:07:08
【问题描述】:
首先,请记住,我是一名专业设计师和自学成才的开发人员。所以请原谅对开发部分缺乏知识。
我使用 .ascx 和 .ascx.cs 后面的代码创建了一个表单。一段时间以来,我一直在成功使用此表单,其中包含基本的文本字段、验证,并在提交后收到一封包含选择的电子邮件。我最近不得不在表单中添加多个复选框。我做了一些研究并使用了下面的代码。它在网站的前端工作得很好,但是当提交表单时,我只能在我的电子邮件中获得一个选项。如何在后面的代码中设置代码,以便我在电子邮件中收到多项选择?
这是 .ascx 代码:
<asp:CheckBoxList ID="CheckBoxWebsolutions" runat="server" AutoPostBack="false" TextAlign="Right" >
<asp:ListItem Value="Website Design">Website Design</asp:ListItem>
<asp:ListItem Value="Content Management System">Content Management System</asp:ListItem>
<asp:ListItem Value="Web App Development">Web App Development</asp:ListItem>
<asp:ListItem Value="Web Hosting">Web Hosting</asp:ListItem>
</asp:CheckBoxList>
这是 .ascx.cs 文件:
sbFormResult.Append(this.FormatAsTableRow("Send me more info on your Web Solutions:", CheckBoxWebsolutions.Text.ToString()));
sbFormResult.Append(this.FormatAsTableRow("Send me more info on your Email & Communications 1:", CheckBoxCommunications1.Text.ToString()));
sbFormResult.Append(this.FormatAsTableRow("Send me more info on your Email & Communications 2:", CheckBoxCommunications2.Text.ToString()));
sbFormResult.Append(this.FormatAsTableRow("Send me more info on your SharePoint Services:", CheckBoxCollaboration.Text.ToString()));
这是电子邮件回复:
Test
Full Name: John Doe
Company Name: ABC Company
Email: jdoe@gmail.com
Phone Number: 1234567890
Comments: Testing
Send me more info on your Web Solutions: Website Design
Send me more info on your Email & Communications 1: Exchange
Send me more info on your Email & Communications 2: Hosted Email Encryption
Send me more info on your SharePoint Services: SharePoint Assessment & Planning
【问题讨论】:
-
我不确定我是否明白你的问题。您在邮件中获得了可能的值,这就是您想要的,对吗?
-
什么是 CheckBoxCommunications1 和 CheckBoxCollaboration?
标签: asp.net .net forms checkbox