10

asp.net(C#)获取GridView列的HeaderText值

我用GridView1.Columns[i].HeaderText获得不了值, GridView1是绑定获得数据的。
SqlConnection Connect_P = new SqlConnection(ClassDeclare.strConnect_P);
//设置command类
SqlCommand GridViewCommand = new SqlCommand(sqlStr, Connect_P);
GridViewCommand.Connection.Open();
//设置Datareader类
SqlDataReader GridViewReader = GridViewCommand.ExecuteReader(CommandBehavior.CloseConnection);
//正常换行
//GridView1.Attributes.Add("style", "word-break:keep-all;word-wrap:normal");
GridView1.DataSource = GridViewReader;
GridView1.DataBind();

查看全部
Athoncj
蔡健常熟
2017/05/26 09:23
  • asp.net
  • 点赞
  • 收藏
  • 回答
    私信

5个回复