日期:2014-05-20 浏览次数:20788 次
[size=12px][color=#FF0000]...省略N行代码[/color][/size] StringBuilder sb = new StringBuilder(); sb.Append(@"<table width='100%' border='0' cellspacing='0' class='jdtablist'> <tbody> <tr> <th width='37%' align='left' style='padding-left: 50px;'> 名称 </th> <th width='9%'> 星级 </th> <th width='9%'> 满意度 </th> <th width='10%'> 人气数 </th> <th width='9%'> 原价 </th> <th width='17%'> 111 </th> </tr> "); string html = @" <tr> <td> <h2> <a target='_blank' href='/Hotels/HotelDetail/{0}'>{1}</a></h2> <b>¥{2}</b> </td> <td align='center'> <span>{3}★</span> </td> <td align='center'> {4} </td> <td align='center'> {5} </td> <td align='center'> ¥{6} </td> <td align='center'> <h2> ¥{7}</h2> <s>¥{8}</s> </td> </tr>"; string str = string.Empty; foreach (var item in List) { str += string.Format(html, item.ID, item.Name, item.Bonus, item.Star, item.Goal + "%", item.HotNum, item.MarketPrice, item.HotelChamberPrice.HasValue ? item.HotelChamberPrice.Value.ToString() : "0", item.ThriftPrice); } sb.AppendFormat("{0}</tbody></table>", str); return sb.ToString(); [size=12px][color=#FF0000]...省略N行代码[/color][/size]