且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在asp.net c#中按数据表按列显示数据

更新时间:2023-12-01 16:05:28

选中此链接.

绑定Gridview [
Check this link.

Bind Gridview[^]


您以编程方式逐行表示吗?

DataTable yourDataTable = null;

//在此处填写数据表

yourDataTable = new DataTable();
//在这里做一些事情来填充数据

//绑定到gridView

yourGridView1.DataSource = yourDataTable();
yourGridView1.DataBind();

数据表中的每个DataRow都对应于GridView行,请记住,您必须使用诸如Eval的绑定表达式
You mean row by row programatically ?

DataTable yourDataTable=null;

//Fill your data table here

yourDataTable = new DataTable();
// do something here to fill the data

//Bind to gridView

yourGridView1.DataSource= yourDataTable();
yourGridView1.DataBind();

Every DataRow in your data table corresponds to your GridView Row , bear in mind you have to use Binding expressions such as Eval


Hope ^ ]可能会帮助您.
Hope this[^] might help you.