手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >GridView中动态设置CommandField是否可用或可见的小例子
GridView中动态设置CommandField是否可用或可见的小例子
摘要:复制代码代码如下:protectedvoidgvMaterial_RowDataBound(objectsender,GridViewRow...

复制代码 代码如下:

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;

}

}

}

【GridView中动态设置CommandField是否可用或可见的小例子】相关文章:

asp.net 两个不同页面的传值

Asp.net实现向上向下排序的例子

asp.net下创建、查询、修改带名称空间的 XML 文件的例子

gridview自动排序示例分享

ASP.NET设计网络硬盘之文件夹实现

asp.net开发微信公众平台之获取用户消息并处理

Net中实现无限分类的2个例子

ASP.net Substitution 页面缓存而部分不缓存的实现方法

asp.net动态载入用户控件的方法

ASP.NET 如何避免页面重新整理时重复送出

精品推荐
分类导航