using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class uc_product_Pall2 : System.Web.UI.UserControl
{
    private string id;
    public string pId
    {
        set
        {
            this.id = value.ToString().Trim();
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = CDatabase.wtoconn();
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from ProductInfo where id="+id, con);
        SqlDataReader sdr2 = cmd.ExecuteReader();
        sdr2.Read();
        this.Pname.Text = SubStr(sdr2.GetString(3),8);
        this.Pname.CssClass = "fonttb2";
        this.Pname.NavigateUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
        this.Pname.Target = "_blank";
        this.Price.Text ="￥"+Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
        this.Pimg.ImageUrl = "~/upfile/" + sdr2.GetString(25).Trim();
        this.Pimg.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
        sdr2.Close();
        con.Close();
    }
    public string SubStr(string sString, int nLeng)
    {
        if (sString.Length <= nLeng)
        {
            return sString;
        }
        string sNewStr = sString.Substring(0, nLeng);
        sNewStr = sNewStr + "...";
        return sNewStr;
    }
}
