表中有10个字段
dataGridView1.DataSource = ds.Tables [0];我用这条语句结果先显示10条语句然后追加我要得4条,怎么这么奇怪的拉,如何只现实我要得4条
dataGridView1.DataSource = ds.Tables [0];我用这条语句结果先显示10条语句然后追加我要得4条,怎么这么奇怪的拉,如何只现实我要得4条
解决方案 »
- c# 序列化成JSON
- 求教用事务向Access数据库中插入一批数据应该怎么弄???
- 求助,CellValueChanged事件
- 求助,在上海的进!~
- 这个函数为什么不可以返回一个小数点后面有两个数字的 double
- 如何设计像SQL SERVER 2000数据转换服务导入/导出向导
- 求盛大的面试经验
- 100分相送 如何在一个treeview中拖动时改变默认的光标??
- 不知哪位能告诉我哪里有得 载 RC2 !!
- C++改成C#中关于随机数产生的函数?
- 想不出来Encoder/Decoder中GetBytes/GetChars函数参数的最后一个那个bool flush是用来干嘛的,谁能写个当他=true和当他=false的对比例子让我看看吗?
- 关于datagridview,想了好久都相不出来的问题
給個例子參考。看是否是能得到你想要的結果
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.ConnectionString = @"data source=.;initial catalog= northwind;integratedsecurity=true";
SqlDataSource1.SelectCommand = "select employeeID,FirstName,LastName from employees"; if (!IsPostBack)
{
GridView1.DataSourceID = "SqlDataSource1";
GridView1.AutoGenerateColumns = false; TemplateField tf1 = new TemplateField();
MyTemplate t1 = new MyTemplate("FirstName");
tf1.HeaderText = "First Name";
tf1.ItemTemplate = t1; TemplateField tf2 = new TemplateField();
MyTemplate t2 = new MyTemplate("LastName");
tf2.HeaderText = "Last Name";
tf2.ItemTemplate = t2; GridView1.Columns.Add(tf1);
GridView1.Columns.Add(tf2);
}
}
部分行:this.dataGridView1.Rows[0].Visible = false;
部分字段:this.dataGridView1.Cloumns[0].Visible = false;visible设为false的行/字段不会显示出来。