一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

DataGrid常见关注问题解决方案

时间:2022-06-30 10:29:52 编辑:袖梨 来源:一聚教程网

Introduction
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
This paper addresses some of the questions about customizing grid display that are commonly asked in newsgroups, on Web sites, and in other developer forums. The techniques described here are sometimes quite simple and at other times somewhat involved. In each case, however, they address a question of how to go beyond the basic functionality of the DataGrid control.
This paper assumes that you are already familiar with the control ― how to add it to a form and configure it to display data. You should also understand how to put a row in the grid into edit mode and other basic tasks. (For details, see DataGrid Web Server Control.) Finally, you will find it helpful to know how to work with templates ― adding template columns to the grid and layout out controls inside a template.
Windows Forms versus Web Forms DataGrid Control
The Web Forms DataGrid control is not the same as the Windows Forms equivalent. It is a common (and not unreasonable) assumption that they are the same control, or at least have identical functionality. However, the entire programming paradigm for Web Forms is quite different from that for Windows Forms. For example, Web Forms pages perform a round trip to the server for any processing; they must manage state; they feature a very different data-binding model; and so on.
Because of these differences, there are also significant differences in their respective controls, including the DataGrid control. As a general rule, the Web Forms DataGrid control includes less built-in functionality. A few examples of differences in the Web Forms DataGrid control are:
It does not inherently support master-detail data structures.

热门栏目