Jquery PrettyPhoto提交按钮

时间:2013-04-02 18:09:37

标签: jquery asp.net webforms lightbox prettyphoto

我正在使用名为Pretty Photo的Jquery灯箱解决方案。我在灯箱中打开一个表单,让用户单击发送电子邮件的提交按钮。单击该按钮时,我收到的电子邮件很好,但其中没有任何信息。有人可以帮忙吗?我的代码在下面是ASPX和ASPX.CS

LandingPage.ASPX.CS

     public partial class LandingPage : WebBasePage
{


      protected void btnSubmit_Click(object sender, EventArgs e)
{
    try
    {
        //Create the msg object to be sent
        MailMessage msg = new MailMessage();
        //Add your email address to the recipients
        msg.To.Add("vdecapite@associatedestates.com");
        //Configure the address we are sending the mail from
        MailAddress address = new MailAddress("vdecapite@associatedestates.com");
        msg.From = address;
        //Append their name in the beginning of the subject
        msg.Subject = txtName.Text + " :  " + ddlSubject.Text;
        msg.Body = txtMessage.Text + " : " + txtName.Text;

        //Configure an SmtpClient to send the mail.
        SmtpClient client = new SmtpClient("smtp.aecrealty.com");
        client.EnableSsl = false; //only enable this if your provider requires it
        //Setup credentials to login to our sender email address ("UserName", "Password")
        NetworkCredential credentials = new NetworkCredential("vdecapite@associatedestates.com", "Vpdc05141989");
        client.Credentials = credentials;

        //Send the msg
        client.Send(msg);

        //Display some feedback to the user to let them know it was sent
        lblResult.Text = "Your message was sent!";

        //Clear the form
        txtName.Text = "";
        txtMessage.Text = "";
    }
    catch
    {
        //If the message failed at some point, let the user know
        lblResult.Text = "Your message failed to send, please try again.";
    }
}
    }

            }

LandingPage.ASPX

 <a href="#inline-1" rel="prettyPhoto" >TEST</a>
<div id="inline-1" class="hide">
       <table>
        <!-- Name -->
        <tr>
            <td align="center">
                Name:</td>
            <td>
                <asp:TextBox ID="txtName"
                                runat="server"
                                Columns="50"></asp:TextBox>
            </td>
        </tr>

        <!-- Subject -->
        <tr>
            <td align="center">
                Subject:
            </td>
            <td>
                <asp:DropDownList ID="ddlSubject" runat="server">
                    <asp:ListItem>Ask a question</asp:ListItem>
                    <asp:ListItem>Report a bug</asp:ListItem>
                    <asp:ListItem>Customer support ticket</asp:ListItem>
                    <asp:ListItem>Other</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>

        <!-- Message -->
        <tr>
            <td align="center">
                Message:
            </td>
            <td>
                <asp:TextBox ID="txtMessage"
                                runat="server"
                                Columns="40"
                                Rows="6"
                                TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>

        <!-- Submit -->
        <tr align="center">
            <td colspan="2">
                <asp:Button ID="btnSubmit" runat="server" Text="Submit"
                    onclick="btnSubmit_Click" UseSubmitBehavior="false"/>
            </td>
        </tr>

        <!-- Results -->
        <tr align="center">
            <td colspan="2">
                <asp:Label ID="lblResult" runat="server"></asp:Label>
            </td>
        </tr>
    </table>
</div>

1 个答案:

答案 0 :(得分:0)

jquery lightbox是否在内容周围添加了表单标记?如果是,您将拥有嵌套表单,即表单内的表单。嵌套表单不是html投诉,并且表现得很有趣。因此,请确保您没有嵌套的表单标记。

希望这有帮助