datagridview 表头绑定一数组 有一数组,存放了列的中文名,我想把datagridview 表头绑定这一数组,请问该如何进行,谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 查数据库的第一列(count(1))。给datagridview。DataSource就行了。 数组循环赋值for(int i=0;i<数组.length;i++){this.dgv.columns[i].headtext=数组[i];} private void Form1_Load(object sender, EventArgs e) { string[] arrayStr = new string[10]; for (int count = 0; count < arrayStr.Length; count++) { arrayStr[count] = "第" + count.ToString() + "列"; this.dataGridView1.Columns.Add(arrayStr[count],arrayStr[count]); } } 在GridView的RowDataBound事件里定义 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { //在这里将你的数组赋值给Header,下面是示例 e.Row.Cells[0].Text = "城市"; e.Row.Cells[1].Text = "国家"; } } Datagridview修改单元格问题 求一个c# 的邮件管理类库 怎样实现查询的功能 刚刚学C#者 如何更改让webbrowser控件打开网页的代码 我在datagrid中嵌套了一个datagrid子控件,我如何实现按照datagrid子控件来分页呀!!! <<讨论>>识别一个文件夹内最新文件的方法!!! 帮我改个函数代码?谢谢 ASP转ASP.NET C#求帮助 c#中能不能得到系统的消息(如:WM_TIMECHANGE) C#中用Findwindow函数时,lpWindowName传入窗口标题,那lpClassName传入何值呢? vs2005界面控件 用户控件(dll)如何调试...
{
this.dgv.columns[i].headtext=数组[i];
}
{
string[] arrayStr = new string[10];
for (int count = 0; count < arrayStr.Length; count++)
{
arrayStr[count] = "第" + count.ToString() + "列";
this.dataGridView1.Columns.Add(arrayStr[count],arrayStr[count]);
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
//在这里将你的数组赋值给Header,下面是示例
e.Row.Cells[0].Text = "城市";
e.Row.Cells[1].Text = "国家";
}
}