网格问题 [英] grid problem

查看:74
本文介绍了网格问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用网格视图在asp.net中显示数据.

我通过使用文本框数据进行过滤,效果很好.

但是,如果在d数据表中找不到数据,则应显示8lst标头文本..... rit在我的情况下为空白,所以我要使用哪个属性

hello to all,

I''m using grid view to show data..in asp.net

m doing filteration by using textbox data it''s working fine..

but if there is no data found in d datatable thn it shoud display 8lst header text.....rit nw in my case it gose blank,,,so which property i hav to use

推荐答案

在此处放置一些代码-也许有人可以为您提供帮助.
Put some code here - someone may be able to help you then.


默认情况下,数据网格已与数据表/数据集绑定.因此,如果没有记录从数据库返回,则您的数据表中不存在任何行,因此没有任何内容显示为gridvew的一部分.这是datagrid的工作原理.

现在,如果要显示标题:
在将数据表与gridview绑定之前,请检查行数.如果该值为零,则从您的侧面显式添加一行,并说空有效值.现在,将此新更新的数据表绑定到gridview.您可以看到带有标题的gridview.

您甚至可以根据需要在行的单元格中添加一些文本-类似于未找到记录"(这将需要编写进一步的代码,例如删除单元格中的控件并添加文本)
By default the datagrid is binded with the datatable/dataset. Thus if no record is returned from the database, your datatable has no rows present and thus nothing is displayed as a part of the gridvew. This is something as datagrid works.

Now, if you want to display header:
Before binding the the datatable with the gridview - check the row count. If that is zero then add a row explicitly from your side with lets say empty valid values. Now bind this new updated datatable to the gridview. You can see the gridview with headers.

you can even add a some text to the cells of the row if needed -something like ''No Records found'' (this will need further code to be written like removing the controls in the cells and adding a text)


这篇关于网格问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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