我对aspx比较陌生。我正在尝试在联系页面中添加一个字段(我已经完成了)并将其显示在生成的电子邮件中(我遇到了问题)。来自表单的电子邮件仍会发送并显示所有字段 - 但我添加的特定字段“ctrlDOP”不会显示结果电子邮件中的文本 - 它只显示#DOP#。
contact.aspx 和contact.xml 页面以及生成的电子邮件如下。提前谢谢了。
--CONTACT.ASPX--
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
<h2>Job Attended / Completed</h2>
<asp:MultiView ID="mvContactForm" runat="server" ActiveViewIndex="0">
<asp:View runat="server" ID="ContactForm" runat="server">
<div class="form contact">
<p>
<asp:Label runat="server" AssociatedControlID="ctrlName">Job Number <asp:RequiredFieldValidator runat="server" ControlToValidate="ctrlName" ErrorMessage="required..."
CssClass="error" Display="Dynamic" /></asp:Label>
<asp:TextBox ID="ctrlName" runat="server" CssClass="txt required" />
</p>
<p>
<asp:Label runat="server" AssociatedControlID="ctrlEmail">Model <asp:RequiredFieldValidator runat="server" ControlToValidate="ctrlEmail" ErrorMessage="required..."
CssClass="error" Display="Dynamic" /></asp:Label>
<asp:TextBox ID="ctrlEmail" runat="server" CssClass="txt required" />
</p>
<p>
<p>
<asp:Label runat="server" AssociatedControlID="ctrlSubject">Serial <asp:RequiredFieldValidator runat="server" ControlToValidate="ctrlEmail" ErrorMessage="required..."
CssClass="error" Display="Dynamic" /></asp:Label>
<asp:TextBox ID="ctrlSubject" runat="server" CssClass="txt required" />
</p>
<p>
<asp:Label runat="server" AssociatedControlID="ctrlMessage">Report <asp:RequiredFieldValidator runat="server" ControlToValidate="ctrlMessage" ErrorMessage="required..."
CssClass="error" Display="Dynamic" /></asp:Label>
<asp:TextBox ID="ctrlMessage" runat="server" CssClass="txt required" TextMode="MultiLine" />
</p>
<asp:Label runat="server" AssociatedControlID="ctrlDOP">DOP <asp:RequiredFieldValidator runat="server" ControlToValidate="ctrlDOP" ErrorMessage="required..."
CssClass="error" Display="Dynamic" /></asp:Label>
<asp:TextBox ID="ctrlDOP" runat="server" CssClass="txt required" TextMode="SingleLine" />
</p>
<p class="commandBar">
<asp:ImageButton ID="cmdSubmit" runat="server" CssClass=""
OnClick="cmdSubmit_Click" SkinID="SubmitButton" AlternateText="Submit Enquiry" />
</p>
<p class="errorMessage"><asp:Literal ID="ErrorMessage" runat="server" EnableViewState="false" />
</p>
<br class="clear" />
</div>
</asp:View>
<asp:View runat="server" ID="ConfirmationMessage">
<p>
Your job info has been submitted.<br />
Ensure the jobsheet makes it to the pigeon hole.
</p>
</asp:View>
</asp:MultiView>
<br class="clear" />
</asp:Content>
--CONTACT.XML--
<?xml version="1.0" encoding="utf-8" ?>
<Email>
<To>scotty@metroappliance.com.au</To>
<From>jobnotification@metroappliance.com.au</From>
<Subject>Job Notification: #SUBJECT#</Subject>
<Priority>Normal</Priority>
<Message format="HTML">
<![CDATA[
<html>
<head>
<title></title>
<style type="text/css">
* {font: 1em/1.5 Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;}
a, a:hover,a:visited,a:active{color:#2F9F49;}
</style>
</head>
<body style="background-color:#00256e;">
<div>
<table border="0" width="600" cellpadding="4" cellspacing="4" style="background-color:#fff;">
<tr>
<td align=justify colspan="4">
<img src="#APP_ROOT#App_Themes/Default/images/email-header.jpg" alt="Metro Appliance">
</td>
</tr>
<tr>
<td>
<p><b>Job attended by #NAME#.</b></p>
<h4>#SUBJECT#</h4>
<h4>#DOP#</h4>
<p>#MESSAGE#</p>
</td>
</tr>
</table>
</div>
</body>
</html>
]]>
</Message>
</Email>
--结果电子邮件--
作业编号参加的作业。串行
DOP
报告
再次 - 我提前感谢所有人。