从数据集绑定Gridview [英] Bind Gridview from Dataset
本文介绍了从数据集绑定Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在DataSet中有许多DataTables ...我想将DataTables的所有行从DataSet绑定到gridview ...任何想法...谢谢!!!
I have many DataTables in DataSet... I want to bind all the rows of DataTables from DataSet to gridview... Any idea for this... Thanks!!!
推荐答案
引用:
ASP.NET技巧:显示来自多个数据表的结果集 [以编程方式与数据集绑定GridView控件 [ GridView.DataBind方法 [如何在网格视图中动态创建列 [ ^ ]
将DataGridView绑定到数据库 [
Refer:
ASP.NET tips: Display resultset from Multiple DataTable[^]
Binding a GridView control programmatically with dataset[^]
GridView.DataBind Method[^]
how to create columns dynamically in a grid view[^]
Binding a DataGridView to a Database[^]
因此,您要说的是要将所有datatables的数据放入单个gridview中.
为此
1.确保datatable
中的所有表都具有相同的架构,否则就不会造成麻烦和复杂.
2.拥有一个临时datatable
并将所有datatables
数据推送到其中.
3.将此gridview
与此临时datatable
绑定.
So you are saying that you want all the datatables'' data into a single gridview.
Well for that
1. ensure that all the tables in thedatatable
have same schema, else its little troublesome and complicated.
2. have a temporarydatatable
and push all thedatatables
data into that.
3. bind thegridview
with this tempdatatable
.
你好
您可以简单地绑定所需的dataTable,例如:-
gridView1.DataSource = datasetObj.Tables ["rizwanTableName,如果它不起作用,请使用索引"];
gridview1.Databind();
hello
you can simply bind dataTable those you need like:-
gridView1.DataSource=datasetObj.Tables["rizwanTableName if it not work then use index "];
gridview1.Databind();
这篇关于从数据集绑定Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文