This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* web_datagrid.aspx: simple datagrid test. svn path=/trunk/xsp/; revision=10273
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<%@ Page Language="C#" %> | ||
<html> | ||
<head> | ||
<title>DataGrid</title> | ||
<style type="text/css"> | ||
<!-- | ||
.Normal | ||
{ | ||
font-family: Verdana, Helvetica, sans-serif; | ||
font-size: 11px; | ||
font-weight: normal; | ||
line-height: 12px | ||
} | ||
.Bold | ||
{ | ||
font-family: Verdana, Helvetica, sans-serif; | ||
font-size: 11px; | ||
font-weight: bold | ||
} | ||
//--> | ||
</style> | ||
<script runat="server"> | ||
void Page_Load (object o, EventArgs e) | ||
{ | ||
if (!IsPostBack) { | ||
ArrayList list = new ArrayList (); | ||
list.Add (new Datum ("Spain", "es", "Europe")); | ||
list.Add (new Datum ("Japan", "jp", "Asia")); | ||
list.Add (new Datum ("Mexico", "mx", "America")); | ||
dg.DataSource = list; | ||
dg.DataBind (); | ||
} | ||
} | ||
public class Datum | ||
{ | ||
private string country; | ||
private string abbr; | ||
private string continent; | ||
public Datum (string country, string abbr, string continent) | ||
{ | ||
this.country = country; | ||
this.abbr = abbr; | ||
this.continent = continent; | ||
} | ||
public string Country | ||
{ | ||
get { return country; } | ||
} | ||
public string Abbr | ||
{ | ||
get { return abbr; } | ||
} | ||
public string Continent | ||
{ | ||
get { return continent; } | ||
} | ||
public override string ToString () | ||
{ | ||
return country + " " + abbr + " " + continent; | ||
} | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<h3>DataGrid sample</h1> | ||
<form runat="server"> | ||
<asp:datagrid id="dg" border="1" AutoGenerateColumns="false" | ||
EnableViewState="false" runat="server"> | ||
<Columns> | ||
<asp:BoundColumn HeaderText="Country" DataField="Country" | ||
ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="Bold" /> | ||
<asp:BoundColumn HeaderText="Continent" DataField="Continent" | ||
ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="Bold"/> | ||
<asp:BoundColumn HeaderText="Abbr" DataField="Abbr" | ||
ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="Bold"/> | ||
</Columns> | ||
</asp:datagrid> | ||
</form> | ||
</body> | ||
</html> | ||