This is a discussion on What is the difference between repeater over datalist and datagrid? within the VB.NET Programming forums, part of the Software Development category; What is the difference between repeater over datalist and datagrid?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Datagrid is most restrictive as regards to customization followed by DataList and finally Repeater is the most customizable. Datagrid has built in paging, sorting and editing capabilities which are not there with the other two controls. So if you want users to sort / page / edit data, datagrid is the natural choice. DataList and repeater have better performance than datagrid. So if performance is a major concern, for example, a site with large number of concurrent visitors, then you could think of datalist or repeater. Repeater is the most customizable. It allows you to create structures like nested lists, for example. A datagrid row displays one record from the data source, while a datalist row can display more than one records (set by RepeatColumns property) Datagrid and Datalist are derived from WebControl while Repeater is not, and so does not have the stylistic properties of web controls. All are similar in that they have a datasource property and ItemCreated, ItemDataBound and ItemCommand events. -Shanthi |
| |||
| difference between repeater over datalist and datagrid: DataGrid: The DataGrid Web control provides the greatest feature set of the three data Web controls, with its ability to allow the end-user to sort, page, and edit its data. The DataGrid is also the simplest data Web control to get started with, as using it requires nothing more than adding a DataGrid to the Web page and writing a few lines of code. The ease of use and impressive features comes at a cost, though, namely that of performance: the DataGrid is the least efficient of the three data Web controls, especially when placed within a Web form. DataList: With its templates, the DataList provides more control over the look and feel of the displayed data than the DataGrid. Using templates, however, typically requires more development time than using the DataGrid's column types. The DataList also supports inline editing of data, but requires a bit more work to implement than the DataGrid. Unfortunately, providing paging and sorting support in the DataList is not a trivial exercise. Making up for these lacking built-in features, the DataList offers better performance over the DataGrid. Repeater: Finally, the Repeater control allows for complete and total control of the rendered HTML markup. With the Repeater, the only HTML emitted are the values of the databinding statements in the templates along with the HTML markup specified in the templates—no "extra" HTML is emitted, as with the DataGrid and DataList. By requiring the developer to specify the complete generated HTML markup, the Repeater often requires the longest development time. Furthermore, the Repeater does not offer built-in editing, sorting, or paging support. However, the Repeater does boast the best performance of the three data Web controls. Its performance is comparable to the DataList's, but noticeably better than the DataGrid's. Thanks KiruthikaSambandam |
| |||
| atagrid is most restrictive as regards to customization followed by DataList and finally Repeater is the most customizable. Datagrid has built in paging, sorting and editing capabilities which are not there with the other two controls. So if you want users to sort / page / edit data, datagrid is the natural choice. DataList and repeater have better performance than datagrid. So if performance is a major concern, for example, a site with large number of concurrent visitors, then you could think of datalist or repeater. Repeater is the most customizable. It allows you to create structures like nested lists, for example. A datagrid row displays one record from the data source, while a datalist row can display more than one records (set by RepeatColumns property) Datagrid and Datalist are derived from WebControl while Repeater is not, and so does not have the stylistic properties of web controls. All are similar in that they have a datasource property and ItemCreated, ItemDataBound and ItemCommand events.
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
| |||
| Difference between repeater over datalist and datagrid all the three controls were created with the same objective, which is to display data When these controls are bound to a datasource, for each entity in the datasource an "item" is created and added to the collection of items for the control. Each Webcontrol's "item" belongs to a different class. For example, a DatagridItem class is derived from TableRow class. This is because the HTML rendered by a datagrid is nothing but an HTML table with rows and columns based upon the datasource it was bound to. Hence each item in a datagrid collection is nothing but an HTML table row, when it is displayed in the browser. One big advantage of the datagrid is that it is very simple to use and easily customizable with some cool color settings for borders,backgrounds etc. It also supports paging and sorting which also is accompanied by some customizable features for example, the way the page index can be displayed, as numbers or "previous and next" links etc. So if you have a source of data that needs to be displayed with no customization or no complex stuff, datagrid is the best choice. But remember, you will have no control over the HTML table that is being rendered. Like the rows, each column in a DataGrid is an instance of a class that is derived from the DataGridColumn class. There are five built-in DataGrid column types: * BoundColumn * ButtonColumn * EditColumn * HyperLinkColumn * TemplateColumn Besides these built-in data types we can also create our own customized DataGrid column types by creating a class that derives from the DataGridColumn class. Most of the newbies out there do not pay attention to the most important issue in datagrids ; Viewstate. ViewState produced by the DataGrid can be humongous if it contains a considerably large number of rows and thus be detrimental to performance. Of course, you DO have the option to turn the viewstate off but then that doesn't help you if you are planning to use sorting, paging and editing features in the datagrid. Apparently the datagrid has the worst performance of all the 3 web controls. The Repeater Web control offers the most flexibility as far as control of the rendered HTML is concerned. The datagrid and datalist controls place the content within a HTML tag like <table> or <span> automatically. That's how they are rendered. But a Repeater control renders ONLY what is specified by the developer. For this reason, if you wish to display data in some way other than in an HTML <table> tag or in a series of <span>tags, Repeater control is the best choice. A Repeater is designed to let the user customize its output and thus have complete control over what is being rendered. So understandably RepeaterItem class is not derived from the TableRow class. Just like in the DataList, with Repeater you specify the markup using templates. The Repeater contains the following five templates: * AlternatingItemTemplate * FooterTemplate * HeaderTemplate * ItemTemplate * SeparatorTemplate An important thing to remember about the Repeater is that, it is not derived from the WebControl class, like the DataGrid and DataList due to which it lacks the stylistic properties common to both the DataGrid and DataList. . But in most cases this is what i want : Complete control over what is being rendered. Among all the 3 web controls in question, Repeater offers the best performance, though only slightly ahead of the datalist but beating datagrid by a considerable margin. Finally about the datalist. The DataList does not use columns as in datagrid.It uses templates to display items just like Repeaters. The advantage of using a template is that with a template, you can specify both a mix of HTML content and databinding syntax. Along with the ItemTemplate the DataList supports six other templates for a total of seven: * AlternatingItemTemplate * EditItemTemplate * FooterTemplate * HeaderTemplate * ItemTemplate * SelectedItemTemplate * SeparatorTemplate By default, the DataList displays each item as an HTML tablerow. But an important property of datalist is the RepeatColumns property. Using this property you can specify how many DataList items should appear per table row. In addition to that, you can also specify if you want the contents of the DataList should be displayed using <span> tags instead of a <table> tags. This is done by setting the RepeatLayout property, to either Table or Flow, which would render the data in HTML <table> tags or in <span> tags. With its templates and RepeatColumns and RepeatLayout properties, it's obvious that the DataList allows for much more customization of the rendered HTML markup than the DataGrid. Thus customization again, is the reason why one might prefer to use a datalist over datagrid. One major advantage of using Datagrid over datalist and repeater is, as already mentioned, the sorting and paging functionality. While such functionality can be implemented with some smart logic in the code, it's the question of how much time and effort would be involved in doing it and whether the trade-off is worth it in the application development process. ThankQ KiruthikaSambandam |
| |||
| Features of a GridView •Displays data as a table •Control over –Alternate item –Header –Footer –Colors, font, borders, etc. –Paging •Updateable •Item as row Features of Repeater •List format •No default output •More control •More complexity •Item as row •Not updateable Features of DataList •Directional rendering •Good for columns •Item as cell •Alternate item •Updateable
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Paging Concept in Repeater? | poornima | ASP and ASP.NET Programming | 1 | 03-21-2008 08:48 PM |
| Which is the best among DataList,Repeater and GridView and Why? | poornima | ASP and ASP.NET Programming | 2 | 03-14-2008 07:44 PM |
| Difference between DataList and Repeater? | poornima | ASP and ASP.NET Programming | 10 | 01-25-2008 02:32 AM |
| How to implement Custom Paging in DataList? | poornima | ASP and ASP.NET Programming | 0 | 01-23-2008 11:57 PM |
| How to decide on the design consideration to take a Datagrid, datalist or repeater in | oxygen | ASP and ASP.NET Programming | 1 | 07-26-2007 03:09 AM |