Saturday, May 11, 2013

How to create template controls using Data Grid Control in asp.net 2.0


A data bound list control that displays the items from data source in a table. The DataGrid control allows you to select, sort, and edit these items.
Column Type
Description
Displays a column bound to a field in a data source.
 It displays each item in the field as text. This is the default column type of the DataGrid control.
Displays a command button for each item in the column. This allows you to create a column of custom button controls, such asAdd or Remove buttons.
Displays a column that contains editing commands for each item in the column.
Displays the contents of each item in the column as a hyperlink. The contents of the column can be bound to a field in a data source or static text.
Displays each item in the column following a specified template. This allows you to provide custom controls in the column.

Use the DataGrid control to display the fields of a data source as columns in a table. Each row in the DataGrid control represents a record in the data source. The DataGrid control supports selection, editing, deleting, paging, and sorting
Different column types determine the behavior of the columns in the control. The following table lists the different column types that can be used.
How to create template controls using Grid View Control in asp.net 2.0

ASP.NET GridView control and how to implement InsertEdit,UpdateDeletePaging and Sorting functions in ASP.NET GridView control. We have received many posts in forums about this popular web control, so this sample provides a complete sample for showing how to implement these basic functions of this control

Gets a collection of DataControlField objects that represent the column fields in a GridView control.


type
Description

Displays the value of a field in a data source. This is the default column type of the GridView control.
Displays a command button for each item in the GridView control. This enables you to create a column of custom button controls, such as the Add or the Remove button.
Displays a check box for each item in the GridView control. This column field type is commonly used to display fields with a Boolean value.
Displays predefined command buttons to perform select, edit, or delete operations.
Displays the value of a field in a data source as a hyperlink. This column field type enables you to bind a second field to the hyperlink's URL.
Displays an image for each item in the GridView control.
Displays user-defined content for each item in the GridView control, according to a specified template. This column field type enables you to create a custom column field.


[Continue to read this..]

How to create template controls using List view Control in asp.net 3.0 
The asp:ListView control supports data editing, insertion, deleting, paging and sorting like another powerful asp.net control GridView.  But - unlike the GridView, it provides us with complete control over the html markup generated like DataList or Repeater control using templates and styles.
The following table lists all the templates that are used with the ListView control.



Identifies the root template that defines the main layout of the control. It contains a placeholder object, such as a table row (tr), div, or spanelement. This element will be replaced with the content that is defined in the ItemTemplate template or in the GroupTemplate template. It might also contain a DataPager object.
Identifies the data-bound content to display for single items.
Identifies the content to render between single items.

No comments:

Post a Comment