//初始化页面产品数据
        private void InitProduct(string producId)
        {
            Products item = ProductsDAL.SelectProductByProductId(producId);

            if (item != null)
            {
                txtProductId.Text           = item.ProductId;
                txtProductName.Text         = item.ProductName;
                txtProductCategoryId.Text   = item.ProductCategoryId;
                txtProductCategoryName.Text = item.ProductCategoryName;
                txtProductCost.Text         = item.ProductCost.ToString();
                txtSalePrice.Text           = item.SalePrice.ToString();
                txtProductUnits.Text        = item.ProductUnits;
                txtCurrentstock.Text        = item.Currentstock.ToString();
                //是否库存提醒
                dwlStockNotifyStatus.Text = item.StockNotifyStatus.ToString();
                //是否发布

                txtRemarks.Text = item.Remarks;
                if (string.IsNullOrEmpty(item.ProductImgFile))
                {
                    imgProductImgFilebtn.AlternateText = "暂无图片";
                    this.imgdelbfbtn.Visible           = false;
                }
                else
                {
                    imgProductImgFilebtn.ImageUrl = "~/ProductImg/" + item.ProductId + "/" + item.ProductImgFile;
                    imgProductImgFilebtn.ToolTip  = item.ProductImgFile;
                }
            }
        }
示例#2
0
        //数据行绑定事件
        protected void gdvProduct_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //1) 文本:vnd.ms-excel.numberformat:@
            //2)日期:vnd.ms-excel.numberformat:yyyy/mm/dd
            //3)数字:vnd.ms-excel.numberformat:#,##0.00
            //4)货币:vnd.ms-excel.numberformat:¥#,##0.00
            //5)百分比:vnd.ms-excel.numberformat: #0.00%
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff';this.style.borderColor='black'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;this.style.borderColor='black'");


                e.Row.Cells[2].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
                e.Row.Cells[5].Attributes.Add("style", "vnd.ms-excel.numberformat:¥#,##0.000");
                e.Row.Cells[6].Attributes.Add("style", "vnd.ms-excel.numberformat:¥#,##0.000");
                if (e.Row.Cells[9].Text == "1")
                {
                    e.Row.Cells[9].Text      = "是";
                    e.Row.Cells[9].ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    e.Row.Cells[9].Text      = "否 ";
                    e.Row.Cells[9].ForeColor = System.Drawing.Color.Red;
                }
                Products item = ProductsDAL.SelectProductByProductId(e.Row.Cells[2].Text);
                if (item != null)
                {
                    if (item.ProductImgFile != string.Empty)
                    {
                        LinkButton lkpimg = e.Row.FindControl("lkpimg") as LinkButton;
                        if (lkpimg != null)
                        {
                            lkpimg.Text    = "查看";
                            lkpimg.ToolTip = item.ProductImgFile;
                        }
                    }
                }
            }
        }