邮件模板,Datatable

今天大部分时间都在纠结邮件模板的问题,问题一大推,烦人~

直接用Response.Write()写在页面上是没有问题,发到邮箱里td与img之间就有空隙,最后将图片的高度设置成了100%,就好使了,原先是将图片设置成固定高度的,不好使,设置成100%好使了,奇怪,同事说是邮件系统自己设置了CSS样式冲突了,邮件系统到今天还没研究。

本来在拼接邮箱时,是直接用的美工截的图,刚拿到手时,心里暗喜,想这下省事了,没想到麻烦一大推,今天至少让自己弄懂了td下面colspan的用法了,colspan是用来表示当前行占先前已经分好列的几列的,以前没搞懂,被他害死了;然后改换table,每个tr下面分列的都用table,又在想当然,实际写代码了,才能验证是否真的掌握。

<table>

<tr>

    <td></td>

    <td></td>

</tr>

<tr>

    <td></td>

</tr>

</table>



不是想象的那样



<table>

<tr>

    <td>

        <table>

            <tr>

                <td></td>

                <td></td>

            </tr>

        </table>

    </td>

</tr>

<tr>

    <td></td>

</tr>

</table>
想象的那样

View Code
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Email Template</title>
</head>
<body>
<table align="center" width="578px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="https://www.kukkle.com" target="_blank"><img src="http://www.kukkle.com/images/email/email_01.png" width="380px" height='100%' style="border:0px"></a></td>
<td><img src="http://www.kukkle.com/images/email/email_02.png" width="198px" height='100%' style=" border:0px"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img src="http://www.kukkle.com/images/email/email_03.png" width="578px" height='100%' style=" border:0px">
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.kukkle.com/images/email/REMINDER_04.png" width="450px" height='100%' style=" border:0px"></td>
<td><img src="http://www.kukkle.com/images/email/email_05.gif" width='128px' height='100%' style=" border:0px"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img src="http://www.kukkle.com/images/email/email_06.png" width="578px" height='100%' style=" border:0px">
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.kukkle.com/images/email/email_07.png" width="44px" height='100%' style=" border:0px"></td>
<td style="width:497px">
<p style="font-family:Arial;font-size:17pt;color:#5ebec7">Dear Peter,</p>
<p style="font-family:Verdana;font-size:12pt;color:#000000">
Your new Password is :<span style="font-family:Verdana bold;font-size:12pt;color:#000000">123456</span>. When you have successfully logged in, please <span style="font-family:Verdana bold;font-size:12pt;color:#000000">MAKE SURE</span> to reset your password for security reasons.<br /><br />
To do this, go to <a href="https://www.kukkle.com" target="_blank">Kukkle.com</a> and:<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;1. Login and go to <a href="https://www.kukkle.com/MyAccount.aspx" target="_blank"><span style="font-family:Verdana bold;font-size:12pt;color:#000000">My Account</span></a> section.<br />
&nbsp;&nbsp;&nbsp;&nbsp;2. Click on the <span style="font-family:Verdana bold;font-size:12pt;color:#000000">Change Password</span> button and <span style="font-family:Verdana bold;font-size:12pt;color:#000000">UPDATE</span>.<br /><br />
Still having trouble? Don’t worry just simply contact our UK Customer Service team on 0843 3177811 for help.<br />
</p>
<p style="font-family:Arial;font-size:17pt;color:#5ebec7">
Have fun and Happy kukkling<br />
the kukkle team
</p>
</td>
<td><img src="http://www.kukkle.com/images/email/email_09.png" width="37px" height='100%' style=" border:0px"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.kukkle.com/images/email/email_10.png" width="85px" height='100%' style=" border:0px"></td>
<td><img src="http://www.kukkle.com/images/email/email_11.png" width="408px" height='100%' style=" border:0px"></td>
<td><img src="http://www.kukkle.com/images/email/email_12.png" width="85px" height='100%' style=" border:0px"></td>
</tr>
</table>
</td>
</tr>
<tr background="http://www.kukkle.com/images/footer_background.png">
<td>
<table style ="list-style: none; margin-top:0px;color: white; width:80% " align="center">
<tr>
<td><a style="font-family:Verdana;font-size:10pt;color:#000000" href="">Home</a></td>
<td><a style="font-family:Verdana;font-size:10pt;color:#000000" href="">Cards</a></td>
<td><a style="font-family:Verdana;font-size:10pt;color:#000000" href="">Contact Us</a></td>
<td><a style="font-family:Verdana;font-size:10pt;color:#000000" href="">Delivery</a></td>
<td><a style="font-family:Verdana;font-size:10pt;color:#000000" href="">Customer Service</a></td>
<td><a style="font-family:Verdana;font-size:11pt;color:#000000" href="">FAQ</a></td></tr>
<tr><td colspan="6" align="center"><span style="font-family:Verdana;font-size:10pt;color:#000000"> Copyright 2011 Kukkle.com</span></td></tr>
<tr style="color: #006747"><td colspan="6" align="center"><a href="" style="font-family:Verdana;font-size:10pt;color:#000000"> Privacy Policy</a>&nbsp;<a href="" style="font-family:Verdana;font-size:10pt;color:#000000">&nbsp;&nbsp;&nbsp;Terms Of Service</a></td></tr>
</table>
</td>

</tr>
</table>
</body>
</html>

最近悲剧的发现,在chrome和IE下面是没有空隙了,但是火狐下面还是有空隙,崩溃了,本来对web前台开发,调试各个浏览器的兼容性还有点小兴趣,今天是一边做一边骂啊~

崩溃~~~下次不搞到这么晚了,没有效率

今天对临时表(Datatable)的掌握有所提高,学会了删除临时表的一行记录,还不是像以前那样一行记录遍历过了在这一行上做记录,但是要记住循环里面要加上 j=j-1,如果记录被删除的话;因为这条记录删除了,然后j=j+1,会导致少遍历一条数据。

           //the content of Email

            DataTable orderEmail = new DataTable();

            orderEmail.TableName = "OrderEmail";

            orderEmail.Columns.Add("SingleUserID");

            orderEmail.Columns.Add("OrderID");



            for (int i = 0; i < userOrder.Rows.Count; i++)

            {

                DataRow emailRow = orderEmail.NewRow();

                emailRow["SingleUserID"] = userOrder.Rows[i]["UserID"];

                emailRow["OrderID"] = userOrder.Rows[i]["OrderID"];

                orderEmail.Rows.Add(emailRow);

                for (int j = i + 1; j < userOrder.Rows.Count; j++)

                {

                    if (userOrder.Rows[j]["UserID"].ToString() == userOrder.Rows[i]["UserID"].ToString())

                    {

                        DataRow emailRow1 = orderEmail.NewRow();

                        emailRow1["SingleUserID"] = userOrder.Rows[j]["UserID"];

                        emailRow1["OrderID"] = userOrder.Rows[j]["OrderID"];

                        orderEmail.Rows.Add(emailRow1);

                        userOrder.Rows.RemoveAt(j);

                        j = j - 1;

                    }

                }

            }

            gvTest.DataSource = orderEmail;

            gvTest.DataBind();

 

On the way~

你可能感兴趣的:(Datatable)