Exemple #1
0
    /// <summary>
    /// 绑定
    /// </summary>
    private void bind()
    {
        string where = "  1=1 ";

        if (txt_title.Text != "")
        {
            where += " and title like '%" + txt_title.Text + "%' ";
        }



        GridView1.DataSource = bll.GetList(where + " order by id desc");
        GridView1.DataBind();
    }
Exemple #2
0
    /// <summary>
    /// 初始化
    /// </summary>
    protected void chushi()
    {
        //根据编号得到相应的记录
        DataSet ds = bll.GetList("  id=" + Request.QueryString["id"]);

        if (ds.Tables[0].Rows.Count > 0)
        {
            txt_title.Text = ds.Tables[0].Rows[0]["title"].ToString();
            Labelpic.Text  = ds.Tables[0].Rows[0]["pic"].ToString();
            if (Labelpic.Text != "" && Labelpic.Text.Length > 3)
            {
                Imagepic.ImageUrl = "../../uploads/" + Labelpic.Text;
                Imagepic.Visible  = true;
            }
            txt_fcal.Text   = ds.Tables[0].Rows[0]["fcal"].ToString();
            Textarea1.Value = ds.Tables[0].Rows[0]["memo"].ToString();
        }
    }
Exemple #3
0
 //初始化
 private void ShowInfo()
 {
     if (Request.QueryString["id"] != null)
     {
         SP.BLL.food bll = new SP.BLL.food();
         //根据编号得到相应的记录
         DataSet       ds    = bll.GetList("  id=" + Request.QueryString["id"]);
         SP.Model.food model = bll.GetModel(int.Parse(Request.QueryString["id"]));
         if (ds.Tables[0].Rows.Count > 0)
         {
             DataRow sdr = ds.Tables[0].Rows[0];
             lbltitle.Text   = sdr["title"].ToString();
             imgpic.ImageUrl = "../../uploads/" + model.pic;
             lblmemo.Text    = sdr["memo"].ToString();
             // lblfcal.Text = sdr["fcal"].ToString()+"卡路里/100g";
             lblatime.Text = sdr["atime"].ToString();
         }
     }
 }