动态Gridview与Static Gridview asp.net [英] Dynamic Gridview vs Static Gridview asp.net

查看:59
本文介绍了动态Gridview与Static Gridview asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要将SQL数据库中查找表的数据显示在asp.net的gridview中。我在db中有大约17个查找表。表的结构是相同的,只是每个查找表的列名不同。

截至目前,我正在动态创建和绑定网格。编辑,更新,删除功能也在后面的代码中实现。

只是想知道,如果动态网格对于上述情况是一个很好的设计,或者我应该将17个不同的静态网格视图绑定到查找表。

哪一个是一个在性能方面更好的设计。?



任何帮助表示赞赏...谢谢..



Gaurav

Hi,
I have a requirement to display data from the lookup tables in SQL database on to a gridview in asp.net. I have around 17 lookup tables in the db. Structure of the tables are same, just that, the column names are different for each lookup table.
As of now, i am creating and binding the grid dynamically. The edit, update , delete functionalities are also implemented in code behind.
Just wanted to know, if dynamic grid is a good design for the above situation or should i bind 17 different static gridviews to the lookup tables.
Which one would be a better design in terms of performance.?

Any help appreciated...thanks..

Gaurav

推荐答案

嗨Gaurav,



总是动态网格需要时间来加载数据,因为它必须在运行时创建网格本身。因此,静态网格在性能水平方面会更好。



正如您所提到的,您的数据库中有17个具有相同模式但具有不同列名的查找表,我建议你使用一个静态网格。



我的建议是将查找表名称放入下拉列表中。在选择所需的查找表时,您可以使用CURD功能维护单个静态网格。



在一个页面中加载17个不同的静态/动态网格也不是一个好的选择想法。!



这里的逻辑是你获得所需的查找表,其中ID作为第一列,描述作为第二列。即使列名不同,也只需使用DB中的别名来获取数据。



谢谢,

Vamsi
Hi Gaurav,

Always a dynamic grid takes time to load the data as it has to create the grid itself in the run-time. So, a static grid would be better in terms of performance levels.

As you have mentioned there are 17 lookup tables in your DB with same schema but with different column names, I would suggest you to use a single static grid.

My suggestion is to get the lookup table names into a Dropdownlist. On selecting the required lookup table, you can maintain a single static grid with CURD functionality.

Loading 17 different static/dynamic grids in a single page is also not a good idea.!

The logic here is you get the required lookup table with ''ID'' as first column and ''Description'' as second column. Even if the column names are different, just use the alias name in the DB to get the data.

Thank you,
Vamsi


非常感谢Vamsi ......这正是我在做。

我在我的aspx页面中定义了一个网格,我在运行时基于查找id绑定它。

我循环遍历所有列名称数据集并在后面的代码中为静态网格创建一个绑定字段。



谢谢,

Gaurav
thanks a lot Vamsi...that is exactly what i am doing.
I have one grid defined in my aspx page and i am binding it on runtime on the basis of a look up id.
I am looping over all the column names in the dataset and creating a bound field for the static grid, in the code behind.

Thanks,
Gaurav


这篇关于动态Gridview与Static Gridview asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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