问题描述
protectedvoidPage_Load(objectsender,EventArgse){stringstr="select*fromdbo.Medicine";dbconectiondb=newdbconection();DataSetds=db.DataAdapter(str);GridView2.DataSource=ds;GridView2.DataBind();GridView2.DataKeyNames=newstring[]{"mno"};this.GridView1.Columns[1].Visible=false;}
解决方案
解决方案二:
this.GridView1.Columns[1].Visible=false;你这gridview1是什么啊?你绑定的是gridview2啊
解决方案三:
SqlConnectionsqlcon=newSqlConnection(myConn);SqlDataAdaptermyda=newSqlDataAdapter(strSql,sqlcon);DataSetmyds=newDataSet();sqlcon.Open();myda.Fill(myds,"EquipmentInfo");GVList.DataSource=myds;GVList.DataKeyNames=newstring[]{"EquipmentInfoID"};//主键GVList.DataBind();sqlcon.Close();
解决方案四:
汗GridView1
解决方案五:
参考GridView怎样隐藏与显示列:seealso:
解决方案六:
GridView1没绑定数据呢
时间: 2024-11-16 19:55:27