<asp:BoundColumn DataField="u_name" HeaderText="名称"></asp:BoundColumn>
解决方案 »
- 监控Window服务程序的问题
- 求VS2008 team版的版本控制的用法(TeamSuit.iso)
- c#中如何判断字符串是汉字或是纯字母
- SoapHttpClientProtocol返回值
- 如何动态使用资源文件中的图片呢??????????? 在线等待中!!!!!!!!!!!
- 在 WinForm 中如何使用 Html 配置参数
- 在C#程序里面如何打开一个可执行程序?
- 关于Acess数据库记录备份并显示消息队列的问题请各位大虾帮帮忙谢谢!!!(急急急)
- vs2003开发的程序在win7里面点击没有反应
- 推荐一些适合初学者看的书吧
- 关于MessageBox的问题
- 求Xceed Zip for .NET 2.0注册码
DataGridTableStyle ts1 = new DataGridTableStyle();//specify the table from dataset (required step)
ts1.MappingName =BW_Table;
// Set other properties (optional step)
ts1.AlternatingBackColor = Color.LightBlue;//STEP 2: Create a string column and add it to the tablestyle
DataGridColumnStyle TextColCURDATE = new DataGridTextBoxColumn();
TextColCURDATE.MappingName = "CURDATE"; //from dataset table
TextColCURDATE.HeaderText = "日期";
TextColCURDATE.Width = 100;
ts1.GridColumnStyles.Add(TextColCURDATE);//STEP 3: Add the tablestyle to your datagrid tablestlye collection
this.dgdBW.TableStyles.Add(ts1);
....
ds.Tables["表1"].Columns["字段1"].ColumnName="你要的名字";
....
datagrid1.DataSource=ds.Tables["表1"];
DataGridTableStyle ts1 = new DataGridTableStyle();//specify the table from dataset (required step)
ts1.MappingName =BW_Table;
// Set other properties (optional step)
ts1.AlternatingBackColor = Color.LightBlue;//STEP 2: Create a string column and add it to the tablestyle
DataGridColumnStyle TextColCURDATE = new DataGridTextBoxColumn();
TextColCURDATE.MappingName = "CURDATE"; //from dataset table
TextColCURDATE.HeaderText = "日期";
TextColCURDATE.Width = 100;
ts1.GridColumnStyles.Add(TextColCURDATE);//STEP 3: Add the tablestyle to your datagrid tablestlye collection
this.dgdBW.TableStyles.Add(ts1);
godblessyU(自由港) 是正确的方法
string sSQL = "select name as 姓名,address as 地址 from user";
然后直接绑定就行了,对DataGrid不用作设置
dgrd.DataSource = ds.Table[0].DefaultView;
dgrd.DataBind();