home

Asp.net Data Controls Tutorial


DataGrid <asp:datagrid><columns></columns></asp:datagrid>

Displays a data list as a HTML table. It has style support and default paging system.

Properties:    


Id=”results”
Runat=”server”
BackColor=”#f6f6da”
Cellspacing=”2”
Cellpadding=”2”
Width=”500”
Height=”500”
HorizontalAlign=”center/right”
GridLines=”both/none/vertical/horizontal”
BorderWidth=”1”
BorderColor=”#000000”
ShowHeader=”false/true”
AlternatingItemStyle-BackColor=”#f6f6da”
AutoGenerateColumns="true/false"
AllowPaging="true/false"
PageSize="2"
PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="center/right"
PagerStyle-PageButtonCount="5"

Creates an unique identifier
Sets  the table for server side processing
Sets a background colour
Sets distance between cells
Sets distance around the cells’ contents
Set table width
Sets table height
Sets table alignment
Sets what borders to display
Sets border height
Sets border colour
Displays/Hides header
Sets an alternating row colour
Creates columns automatically
Allow record paging
Sets maximum number of records to display
Create pages in numbers
Aligns the paging
Sets maximum number of pages to display


Template Column <asp:templatecolumn></asp:templatecolumn>

Determines the area where custom columns can be created.

Example:

<asp:templatecolumn>
          <headertemplate>………</headertemplate>
          <itemtemplate>………</itemtemplate>
<footertemplate>………</footertemplate>
</ asp:templatecolumn>

Properties:


DataField=”pid”
Visible=”true/false”
HeaderText=”Product ID”
HeaderStyle-HorizontalAlign=”left”
ItemStyle-HorizontalAlign=”center”

Sets the column table (Data table) to display
Sets visibility
Sets a Header for column (data table)
Sets header alignment
Sets columns (items) alignment

Bound Column <asp:boundcolumn/>

Creates a column that outputs a single value.

Example:

<asp:boundcolumn DataField=”Pname” HeaderText=”Product Name”/>

Properties:


DataField=”pid”
Visible=”true/false”
HeaderText=”Product ID”
HeaderStyle-HorizontalAlign=”left”
ItemStyle-HorizontalAlign=”center”

Sets the column table (Data table) to display
Sets visibility
Sets a Header for column (data table)
Sets header alignment
Sets columns (items) alignment

 

Repeater <asp:repeater></asp:repeater>

Displays data items in a repeating list. It has no style support and no default paging system.

Example:

<asp:repeater id=”rpt” runat=”server”>
<headerTemplate>….<headerTemplate>
<itemTemplate>….<itemTemplate>
<footerTemplate>….<footerTemplate>
</asp:repeater>


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

all rights reseverd by Cramerz.com©. web development by web design company DotPeak. hosting by HostBay
all contents on cramerz are the property of Cramerz.com. web design courses