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

ASP.NET
ASP.NET中Session丢失原因与解决方案小结
.net开发中的一些注意事项及小技巧
学习Asp.Net经常会用到的函数集
在.net App中集成COM组件的一些简单技巧
彻底放弃IIS让Apache也支持ASP.NET
[JS.IntelliSense]VS2007(Orcas) So Cool
Asp.net 2.0 ViewState原理
asp.net ajax 使用updatepanel进行更新后的提示
动态代理DynamicProxy 介绍
您可能不知道的.Net2.0小技巧
Asp.Net2.0技巧(续)
“黑盒测试管理”以外的编程经验片断
实例开发:ASP.NET创建网络相册
封装stream,在读写stream时提供事件通知
GIS开发随笔--GIS技术的一点理解和MapNet控件试验
利用隐藏帧打印url的方法比较
无刷新仿google波形扭曲彩色Asp.net验证码
存储过程编写经验和优化措施
编程技巧:.Net Framework
编程技巧OOPs:复制构造函数

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 157 ::
收藏到网摘: 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); }