GridView绑定字段 [英] GridView bound Field

查看:116
本文介绍了GridView绑定字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hizzzzZ全部

我创建一个从数据库填充的网格视图,并通过代码(而不是向导)创建整个Grid,然后添加一个新的绑定字段"edit",我的问题是如何使此字段在某些行中可见而在其他行中不可见! ?!?!? :omg:


请注意,我使用的是asp.net 2.0,C#环境

感谢您的帮助

hizzzzZ all

i create a grid view that filled from database , and make the whole Grid by code (not wizard) , then i add a new bound field "edit" , my Question is how to make this field visible in some rows and invisible in others !?!?!? :omg:


notice that i use asp.net 2.0 , C# environment

I''ll be thankful for any help

推荐答案

您可以使用gridview的RowDatabound事件

You can use RowDatabound event of gridview

if (e.Row.RowType == DataControlRowType.DataRow)
{
        if (e.Row.Cells[0].Text == null) // your condition here
                 e.Row.Cells[4].Visible = false; 
                 // e.Row.Cells[4] is your bound field "edit"
}


这篇关于GridView绑定字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆