http://user.qzone.qq.com/810087456/infocenter

ymecho

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 protected void gvMaterial_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Visible = false;
              
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[1].Text = (gvMaterial.PageIndex * gvMaterial.PageSize + e.Row.RowIndex + 1).ToString();
                string price;
                try //让编辑功能在特定条件下可以用
                {
                     price = ((TextBox)e.Row.Cells[4].Controls[0]).Text;//点编辑的时候用
                }
                catch
                {
                     price = e.Row.Cells[4].Text;    //出始时用
                }                          
                if (price == "" || price == " ")
                {
                    e.Row.Cells[7].Controls[0].Visible = false;
                }
                else
                {
                    e.Row.Cells[7].Controls[0].Visible = true;
                }
            }
        }

 

posted on 2013-05-07 21:54  ymecho  阅读(411)  评论(1编辑  收藏  举报