Cyberoxy 0 Newbie Poster

Hey!

I have been trying several times to fix it but couldnt find correct codes in C#. You can copy all these below codes of markup and C# so that you will see what is problem. Im fine with markup but only problem with C#. There is some explanations (bold and underline) below. You can check out my url http://www.ellierose.co.za/Contact.aspx - it will probably help you to get picture in your mind. Your help will be highly appreciated. Thanks so much for your time :-) Looking forward to hearing from you!

Markup:

 <form id="Form1" method="post" runat="server"> 

 <label><asp:TextBox ID="txtName" runat="server"></asp:TextBox>Name:</label>

<label><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>Email Address:</label>

Order the following cards:

<asp:ListBox name="order" Runat="server" ID="dlist1" SelectionMode="Multiple" onchange="swapImage1()">
 <asp:ListItem>SOW SEEDS OF LOVE</asp:ListItem>
<asp:ListItem data-card="R 32.00" data-memo="R 62.00" Value="Images/Bday.jpg">Birthday</asp:ListItem>
<asp:ListItem data-card="32.00" data-memo="62.00"  Value="Images/Wedding.jpg">Wedding</asp:ListItem>
 </asp:ListBox>

Display prices when clicked an item on listbox control:

<script type="text/javascript">

window.onload = function()

{
    document.getElementById("dlist1").onchange = function() {
        var option = this.options[this.selectedIndex];
        document.getElementById("price_card").innerHTML = option.getAttribute("data-card") ? option.getAttribute("data-card") : "";
        document.getElementById("price_memo").innerHTML = option.getAttribute("data-memo") ? option.getAttribute("data-memo") : "";

}

}

</script>

Display image when clicked an item on this ListBox control (above):

<div>
<asp:Image[B] ID="imageToSwap1"[/B] runat="server" width="147" height="195" ImageUrl="" />
</div>

<script type="text/javascript">
  function [B]swapImage1()[/B] {
                                     var image = document.getElementById('<%= imageToSwap1.ClientID %>');
                                     var dropd = document.getElementById('<%= dlist1.ClientID %>');
                                     image.src = dropd.value;
                                 };
</script>

1) After choosing an item (birthday card) on ListBox control, then you decide to choose "card A6" on input control using checkbox but you also choose another item (wedding card) on ListBox control, so you also choose "memo book" (only for wedding card)

2) Look below (bold) -- id="price_card" and id="price_memo" are implemented by Javascript to display several price

<table>

        <tr>

        <td input type="checkbox" name="description" value="Card A6" id="description1" runat="server" /> Card A6 (blank)</td>

        <td id="[B]price_card[/B]"></td>
        </tr>
        <tr>
            <td input type="checkbox" name="description" value="Memo Book A6" id="description2" runat="server" /> Memo book </td>

           <td id="[B]price_memo[/B]"></td>       

       </tr>

</table>

For example: if you wanna order two cards (card A6 for birthday card and memo book for wedding card), then clicking on send button to send this data to my gmail account:

 <asp:Button ID="Send" runat="server" Text="Send Email" onclick="Send_Click1" />

</from>

I have no problem with this markup but have a little problem with codes (C#). After you sent order data to my gmail account, I will get your email and can read this data what you wanna order.

This order data should be displayed on email: (thats what I want)

Name: xxx

Email Address: xxx

Order 1: Images/Birthday.jpg

Description 1: Card 6

Order 2: Images/Wedding.jpg

Description 2: Memo Book

My current problem:

Name: xxx

Email Address: xxx

Order 1: Images/Birthday.jpg (no display)

Description 1: Card 6 (display) - fine

Order 2: Images/Wedding.jpg (no display)

Description 2: Memo Book (no display)

Im struggling with codes in C# - look at below and you can test these codes (copy) to receive your email on your gmail account after clicking on send button. You will see some order data is missing:

    protected void Send_Click1(object sender, EventArgs e)  

{

        string msg = "---------------------------<br>";
        string from = "youremail@gmail.com";
        string to = "youremail@gmail.com";

        MailMessage mail = new MailMessage();
        mail.To.Add(to);
        mail.From = new MailAddress(from, "Ellie Rose", System.Text.Encoding.UTF8);
        mail.Subject = "Customer Order from Ellie Rose Website";
        mail.SubjectEncoding = System.Text.Encoding.UTF8;


        msg += "Name: " + txtName.Text;
        msg += "<br>Email: " + txtEmail.Text;


        if (description1.Checked == true) [B]//Card A6 - need to display data on email - not working[/B]
        {
            msg += "<br>Description 1:" + description1.Value;
            msg += "<br>ORDER 1: " + Request["order"];
        }
        if (description2.Checked == true) [B]//Memo Book - need to display data on email - not working[/B]
        {
            msg += "<br>Description 2:" + description2.Value;
            msg += "<br>ORDER 2 : " + Request["order"];
        }


        mail.Body = msg;
        mail.BodyEncoding = System.Text.Encoding.ASCII;
        mail.IsBodyHtml = true;
        mail.Priority = MailPriority.High;

        SmtpClient client = new SmtpClient();
        //Add the Creddentials- use your own email id and password

        client.Credentials = new System.Net.NetworkCredential(from, "yourpassword");

        client.Port = 587; // Gmail works on this port
        client.Host = "smtp.gmail.com";
        client.EnableSsl = true; //Gmail works on Server Secured Layer
        try
        {
            client.Send(mail);
        }
        catch (Exception ex)
        {
            Exception ex2 = ex;
            string errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2 = ex2.InnerException;
            }
            HttpContext.Current.Response.Write(errorMessage);
        } // end try

    }