且构网

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

如何在ASP.NET中绑定gridview中的数据

更新时间:2021-07-10 02:54:09

创建gridview并设置 AutoGenerateColumns =true

并将数据表绑定到它。



Create a gridview and set the property of AutoGenerateColumns="true"
and bind the datatable to it.

<asp:GridView runat="server" ID="gridViewName" AutoGenerateColumns="true"></asp:GridView>




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


您好,请参阅以下链接,

1.
Hi, refer below links,
1.
Control.DataBind Method ()





[ ^ ]

2. GridView.DataBind方法(System.Web.UI.WebControls) [ ^ ]