求助GridView1绑定的列隐藏问题
gdview.DataSource = dataset;
我用以上方法实现数据绑定后,又在gdview中加入几列,如下:
Columns>
<asp:BoundField HeaderText= "名称 " DataField= "NAME " />
<asp:BoundField HeaderText= "图层 " DataField= "LayerName "Visible= "False " />
</Columns>
DataField与dataset的列字段相同,数据在gdview中显示出来了,有向gdview加入的DataField字段,还有dataset的字段,要把dataset的字段隐藏掉,如何实现,
请高手帮忙
------解决方案-------------------- protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
GridView1.Columns[列索引].Visible=false ;
}