如何在asp.net的gridview中的html表中绑定数据? [英] how to bind data in html table in gridview in asp.net?

查看:136
本文介绍了如何在asp.net的gridview中的html表中绑定数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想将数据绑定到html datatable中,并希望在gridview中显示

我该怎么办?

帮帮我...........

hey guys i want bind data in html datatable and want to display in gridview

how can i do that ?

help me...........

推荐答案

这个问题没有道理.您的数据不在html数据表中,它可能在数据表中,并且您想在gridview中显示它.如何做到这一点是微不足道的,这是如果您购买了一本书并阅读了有关gridviews的第一件事.将gridview的数据源设置为您的数据表并调用databind.您可以设置gridview的样式以控制用于显示数据的HTML.
This question makes no sense. Your data is not in a html datatable, it might be in a datatable and you want to show it in a gridview. How you do that, is trivial, and the first thing you would learn if you bought a book and read about gridviews. Set the data source of the gridview to be your data table and call databind. You can style the gridview to control the HTML that''s used to show your data.


Gridview中没有类似HTML Table的东西.

看起来您想以网格(表格形式)显示一些数据.如果是这样,请尝试:
There is nothing like HTML Table in Gridview.

It looks like you want to show some data in grid (tabular form). If so, try:
DataTable dt = new DataTable();
dt.Columns.Add("Column1");
dt.Columns.Add("Column2");
dt.Rows.Add("1","One");
dt.Rows.Add("2","Two");
mygridView.DataSource = dt;
mygridView.DataBind();


因此,您需要先填充数据表,然后再将其作为网格绑定的数据源提供.


So, you need to populate the datatable first and then provide that as a datasource to grid to bind.


这篇关于如何在asp.net的gridview中的html表中绑定数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆