当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > VS的控件真是不好用,好不容易才搞定DataGrid

ASP.NET
如何在命令行下编译一个asp.net项目
ADO 与ADO.NET
当VS.NET2003遇上VS.NET2005,WebService部署何去何从
昨日关注:逐步解说: 将Web Form网页国际化
在.NET下编写中文代码程序
防止同一个程序多次运行。 [VB.NET]
Visual C#设计多功能关机程序
什么是Web Service?
实现ListView控件的行间隔颜色的优化代码
失去信心?还是再度迷惘(二):Mono only is Mono,not .NET never
在Winform中发HTTP请求(调用WebService服务)
.NET中加密和解密的实现方法 3
notNET中加密和解密的实现方法
.NET中加密和解密的实现方法2
mshtml:javascript为HTML文件中的Select添加option
VS.NET解决方案的兼容问题
关于创建快捷方式的小结
使用 GDI+ 进行双缓冲绘图
如何用DataGrid实现根据日期判断是否显示New标志
昨日关注:C-omega vs ADO.net

ASP.NET 中的 VS的控件真是不好用,好不容易才搞定DataGrid


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 51 ::
收藏到网摘: n/a


摘一段自定义DataGrid样式的贴上来共享:
private void RunProc_Load(object sender, System.EventArgs e) { procData=new SqlDataProvider(ConnectionString).GetProcColumn(ProcName); procData.Tables[0].Columns.Add("parmvalue"); procData.Tables[0].Columns.Add("Direction"); procData.Tables[0].Columns.Remove("isoutparam"); AddDataGrid(new DataView(procData.Tables[0])); }
private void AddDataGrid(DataView dv) { DataGridTextBoxColumn TxtCol =new DataGridTextBoxColumn(); dataGrid1.TableStyles.Clear(); dataGrid1.DataSource=dv; DataGridTableStyle ts= new DataGridTableStyle(); ts.MappingName ="SqlBuilder"; dv.AllowNew=false; dv.AllowDelete=false; dv.AllowEdit=false;
TxtCol =new DataGridTextBoxColumn(); TxtCol.MappingName ="name"; TxtCol.HeaderText ="参数名"; TxtCol.Width =100; TxtCol.ReadOnly=true; ts.GridColumnStyles.Add(TxtCol); TxtCol =new DataGridTextBoxColumn(); TxtCol.MappingName ="xtypename"; TxtCol.HeaderText ="参数类型"; TxtCol.Width =75; TxtCol.ReadOnly=true; ts.GridColumnStyles.Add(TxtCol);

TxtCol =new DataGridTextBoxColumn(); TxtCol.MappingName ="length"; TxtCol.HeaderText ="参数长度"; TxtCol.Width =75; TxtCol.ReadOnly=true; ts.GridColumnStyles.Add(TxtCol);
TxtCol =new DataGridTextBoxColumn(); TxtCol.MappingName ="Direction"; TxtCol.HeaderText ="传递方向"; TxtCol.Width =75; TxtCol.ReadOnly=true; ts.GridColumnStyles.Add(TxtCol);
dv.AllowEdit=true; TxtCol =new DataGridTextBoxColumn(); TxtCol.MappingName ="parmvalue"; TxtCol.HeaderText ="测试值"; TxtCol.Width =100; TxtCol.ReadOnly=false; ts.GridColumnStyles.Add(TxtCol); dataGrid1.TableStyles.Add(ts); }