Author: lluis Date: 2005-03-24 10:02:25 -0500 (Thu, 24 Mar 2005) New Revision: 42218
Added: trunk/xsp/test/2.0/gridview/ trunk/xsp/test/2.0/gridview/BasicGrid.aspx trunk/xsp/test/2.0/gridview/ObjectBoundGrid.aspx trunk/xsp/test/2.0/gridview/data.xml Log: Added some basic grid samples. Added: trunk/xsp/test/2.0/gridview/BasicGrid.aspx =================================================================== --- trunk/xsp/test/2.0/gridview/BasicGrid.aspx 2005-03-24 14:46:17 UTC (rev 42217) +++ trunk/xsp/test/2.0/gridview/BasicGrid.aspx 2005-03-24 15:02:25 UTC (rev 42218) @@ -0,0 +1,41 @@ +<%@ Page Language="C#" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> + +<script runat="server"> +</script> + +<html xmlns="http://www.w3.org/1999/xhtml" > +<head runat="server"> + <title>Untitled Page</title> +</head> +<body> + <form id="form1" runat="server"> + <h1>Simple GridView</h1> + <p> + This grid reads the data from <a href="data.xml">data.xml</a>. + </p> + <div> + <asp:GridView AutoGenerateColumns="False" DataSourceID="XmlDataSource1" ID="GridView1" + AllowPaging="True" PageSize="5" + AllowSorting="True" + AutoGenerateEditButton="True" + AutoGenerateDeleteButton="True" + AutoGenerateSelectButton="True" + EnableSortingAndPagingCallbacks="false" + DataKeyNames="name" + runat="server"> + <Columns> + <asp:BoundField DataField="name" HeaderText="name" SortExpression="name"></asp:BoundField> + <asp:BoundField DataField="value" HeaderText="value" SortExpression="value"></asp:BoundField> + </Columns> + <AlternatingRowStyle BackColor="#FFFFc0"/> + <SelectedRowStyle BackColor="red"/> + <PagerSettings Mode="Numeric"/> + </asp:GridView> + + </div> + <asp:XmlDataSource DataFile="data.xml" ID="XmlDataSource1" runat="server"></asp:XmlDataSource> + </form> +</body> +</html> Property changes on: trunk/xsp/test/2.0/gridview/BasicGrid.aspx ___________________________________________________________________ Name: svn:executable + * Added: trunk/xsp/test/2.0/gridview/ObjectBoundGrid.aspx =================================================================== --- trunk/xsp/test/2.0/gridview/ObjectBoundGrid.aspx 2005-03-24 14:46:17 UTC (rev 42217) +++ trunk/xsp/test/2.0/gridview/ObjectBoundGrid.aspx 2005-03-24 15:02:25 UTC (rev 42218) @@ -0,0 +1,88 @@ +<%@ Page Language="C#" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> + +<script runat="server"> + + protected void Page_Load(object sender, EventArgs e) + { + ArrayList list = new ArrayList(); + list.Add (new Dada(1)); + list.Add(new Dada(2)); + list.Add(new Dada(3)); + list.Add(new Dada(4)); + list.Add(new Dada(5)); + list.Add(new Dada(6)); + list.Add(new Dada(7)); + list.Add(new Dada(8)); + list.Add(new Dada(9)); + list.Add(new Dada(10)); + list.Add(new Dada(11)); + + GridView1.DataSource = list; + GridView1.DataBind(); + } + + class Dada + { + public Dada(int n) + { + un = n; + dos = "[" + n + "]"; + tres = new DateTime(2005, 3, n); + quatre = (n % 2) == 0; + } + + int un; + string dos; + DateTime tres; + bool quatre; + + public int IntegerColumn + { + get { return un; } + set { un = value; } + } + + public string StringColumn + { + get { return dos; } + set { dos = value; } + } + + public DateTime DateTimeColumn + { + get { return tres; } + set { tres = value; } + } + + public bool BooleanColumn + { + get { return quatre; } + set { quatre = value; } + } + } +</script> + +<html xmlns="http://www.w3.org/1999/xhtml" > +<head runat="server"> + <title>Untitled Page</title> +</head> +<body> + <h1>Object Bound GridView</h1> + <p>This grid takes data from an ArrayList of objects. Columns are autogenerated from object's properties.</p> + <form id="form1" runat="server"> + <div> + <asp:GridView ID="GridView1" runat="server" + AllowPaging="True" PageSize="5" AutoGenerateEditButton="true" AutoGenerateColumns="true" + > + <PagerSettings Mode="NextPrevious"/> + <AlternatingRowStyle BackColor="#FFFFc0"/> + <SelectedRowStyle BackColor="red"/> + </asp:GridView> + <asp:Button runat="server"/> + + </div> + </form> +</body> +</html> Property changes on: trunk/xsp/test/2.0/gridview/ObjectBoundGrid.aspx ___________________________________________________________________ Name: svn:executable + * Added: trunk/xsp/test/2.0/gridview/data.xml =================================================================== --- trunk/xsp/test/2.0/gridview/data.xml 2005-03-24 14:46:17 UTC (rev 42217) +++ trunk/xsp/test/2.0/gridview/data.xml 2005-03-24 15:02:25 UTC (rev 42218) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<data> + <item name="first item" value="1"/> + <item name="second item" value="2"/> + <item name="third item" value="3"/> + <item name="fourth item" value="4"/> + <item name="fifth item" value="5"/> + <item name="sixth item" value="6"/> + <item name="fifth item" value="5"/> + <item name="sixth item" value="6"/> + <item name="fifth item" value="5"/> + <item name="sixth item" value="6"/> + <item name="fifth item" value="5"/> + <item name="sixth item" value="6"/> + <item name="fifth item" value="5"/> + <item name="sixth item" value="6"/> + <item name="fifth item" value="5"/> + <item name="sixth item" value="6"/> +</data> Property changes on: trunk/xsp/test/2.0/gridview/data.xml ___________________________________________________________________ Name: svn:executable + * _______________________________________________ Mono-patches maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-patches
