在html联系aspx中添加显示字段

时间:2012-11-27 03:29:47

标签: asp.net html contact

我对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>

- 导致电子邮件 -

jobnumber参加的工作。 串行

DOP

报告

再次 - 我提前感谢所有人。

1 个答案:

答案 0 :(得分:0)

问题在于您正在替换#DOP#的电子邮件生成代码,您尚未发布它,但可能错误地为零而不是O.