ASP.NET : How to use Table
- Asp.net table web server
control display a table on a web page.
- It is a .net web server control
so we can program it in server code such as add , remove table row, cell
programmatically.
- (TableRow) and (TableCell) web
server controls allow us to display content for the table. table server control
display tabular data and we can format table server control using it's built in
methods and properties.
- The big difference between (html
table) and (asp.net table) server control is that we can manipulate table
server control using an object model. generally we should use table server
control when we intend to add remove rows and cells (columns) programmatically
at run time.
- Table server control acts as a parent (container) for TableRows controls. table
control's Rows property is a collection of TableRow objects. each TableRow
control has a collection named Cells. Cells collection contains TableCell objects. actually
table server control display the TableCell controls content.
- TableCell control's Text property value store any html text.
you also can add and display controls inside table cell.
- Table have many properties to control it's appearance such as BackColor,
ForeColor, BorderColor, BorderWidth, BorderStyle, Height, BackImageUrl,
Caption, CellPadding, CellSpacing, CssClass, GridLines, Font, HorizontalAlign,
Style, SkinID etc. TableRow and TableCell control support many of these
properties as well. even we can change any individual cell's or row's
appearance and look.
- Table server control can display data from a database. but table control does
not provide any property that we can use to directly display database data.
- The following c# example code describe you more about
asp.net table web server control.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to use Table in asp.net</title>
</head>
<body style="padding:25px">
<form id="form1" runat="server">
<div>
<h2 style="color:MidnightBlue; font-style:italic;">
How to use Table in asp.net
</h2>
<hr width="450" align="left" color="Gainsboro" />
<asp:Table ID="Table1"
runat="server"
Font-Size="X-Large"
Width="550"
Font-Names="Palatino"
BackColor="Orange"
BorderColor="DarkRed"
BorderWidth="2"
ForeColor="Snow"
CellPadding="5"
CellSpacing="5"
>
<asp:TableHeaderRow
runat="server"
ForeColor="Snow"
BackColor="OliveDrab"
Font-Bold="true"
>
<asp:TableHeaderCell>Serial</asp:TableHeaderCell>
<asp:TableHeaderCell>Name</asp:TableHeaderCell>
<asp:TableHeaderCell>Value</asp:TableHeaderCell>
</asp:TableHeaderRow>
<asp:TableRow
ID="TableRow1"
runat="server"
BackColor="OrangeRed"
>
<asp:TableCell>1</asp:TableCell>
<asp:TableCell>Azure</asp:TableCell>
<asp:TableCell>#F0FFFF</asp:TableCell>
</asp:TableRow>
<asp:TableRow
ID="TableRow2"
runat="server"
BackColor="DarkOrange"
>
<asp:TableCell>2</asp:TableCell>
<asp:TableCell>Beige</asp:TableCell>
<asp:TableCell>#F5F5DC</asp:TableCell>
</asp:TableRow>
<asp:TableRow
ID="TableRow3"
runat="server"
BackColor="OrangeRed"
>
<asp:TableCell>3</asp:TableCell>
<asp:TableCell>Bisque</asp:TableCell>
<asp:TableCell>#FFE4C4</asp:TableCell>
</asp:TableRow>
<asp:TableRow
ID="TableRow4"
runat="server"
BackColor="DarkOrange"
>
<asp:TableCell>4</asp:TableCell>
<asp:TableCell>Crimson</asp:TableCell>
<asp:TableCell>#DC143C</asp:TableCell>
</asp:TableRow>
<asp:TableRow
ID="TableRow5"
runat="server"
BackColor="OrangeRed"
>
<asp:TableCell>5</asp:TableCell>
<asp:TableCell>Cyan</asp:TableCell>
<asp:TableCell>#00FFFF</asp:TableCell>
</asp:TableRow>
<asp:TableFooterRow
runat="server"
BackColor="DarkOrange"
>
<asp:TableCell
ColumnSpan="3"
HorizontalAlign="Right"
Font-Italic="true"
>
Number of colors 5
</asp:TableCell>
</asp:TableFooterRow>
</asp:Table>
</div>
</form>
</body>
</html>
basic asp.net mvc tutorials, Free asp.net mvc Tutorials for beginners, mvc, asp.net mvc, .net tutorials, mvc tutorial, mvc tutorials, asp.net mvc tutorials, mvc tutorial, mvc tutorials for Beginners , asp.net mvc Basics, basic mvc, mvc4, mvc5,.net mvc