复制代码 代码如下:
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;
}
}
}
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;
}
}
}
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“GridView中动态设置CommandField是否可用或可见的小例子”评论...