直接上代码
aspx页面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Couponlist.aspx.cs" Inherits="Coupon_Couponlist" %>优惠券页面 <%=str %>
aspx.cs后台
public string str=""; protected void Page_Load(object sender, EventArgs e) { string bbid=Request.QueryString["bbid"]; string ppid = Request.QueryString["ppid"]; if (!string.IsNullOrEmpty(bbid) && !string.IsNullOrEmpty(ppid)) { getCouponList(bbid, ppid);//获取优惠券列表 } else { ClientScript.RegisterStartupScript(this.GetType(), "message", ""); } } private void getCouponList(string bbid,string ppid) { string sql = string.Format("select * from v_couponlist where bbid={0} and ppid={1}",bbid,ppid); DataTable dt = SqlHelper.ExecuteTable(sql); if (dt!=null&&dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string thisdate = ""; if (Convert.ToInt32(dt.Rows[i]["LastDay"]) > 0) { thisdate = "发券后" + Convert.ToInt32(dt.Rows[i]["LastDay"]) + "天有效"; } else { thisdate = "有效期" + php.GetFormatDatedian(dt.Rows[i]["StartDate"].ToString()) + "-" + php.GetFormatDatedian(dt.Rows[i]["EndDate"].ToString()); } if (Convert.ToInt32(dt.Rows[i]["CouponType"]) == 1) { str += "
"+ "
"+ " 满减券
"+ "消费金额满 " + Convert.ToDecimal(dt.Rows[i]["PayMoney"]).ToString("f2") + "元可用
" +//Convert.ToDecimal(Eval("sale")).ToString("f2") "" + thisdate + "
" + " ¥" + Convert.ToDecimal(dt.Rows[i]["CouponMoney"]).ToString("f2") + "
"+ "
"+ " 礼品券
"+ "到店消费领取[" + dt.Rows[i]["Gift"] + "]
" + ""+thisdate+"
"+ "
静态页效果