--- /dev/null
+<%@ Page Language="VB" ResponseEncoding="iso-8859-1" Debug="true" %>\r
+<%@ Register TagPrefix="Rico" Assembly="Rico" NameSpace="Rico" %>\r
+<%@ Register TagPrefix="My" TagName="dbLib" Src="dbConnect.ascx" %>\r
+<My:dbLib id='app' runat='server' />\r
+\r
+<script runat="server">\r
+\r
+Sub Page_Load(Sender As object, e As EventArgs)\r
+ dim category,lastCategory,Discounts,Gross,subtotals(1),grandtotals(1),i\r
+ dim command,rdr\r
+\r
+ if not app.OpenDB() then exit sub\r
+ \r
+ for i=0 to 1\r
+ grandtotals(i)=0\r
+ next\r
+\r
+ command = app.dbConnection.CreateCommand()\r
+ command.CommandText="select CategoryName,ProductName, " & _\r
+ "SUM(od.UnitPrice*Quantity) as GrossSales, " & _\r
+ "SUM(od.UnitPrice*Quantity*Discount) as Discounts " & _\r
+ "from ((Order_Details od " & _\r
+ "inner join Products p on p.ProductID=od.ProductID) " & _\r
+ "inner join Categories c on p.CategoryID=c.CategoryID) " & _\r
+ "group by CategoryName,ProductName " & _\r
+ "order by CategoryName,ProductName"\r
+ rdr = command.ExecuteReader()\r
+ while rdr.Read()\r
+ category=rdr("CategoryName")\r
+ Gross=rdr("GrossSales")\r
+ Discounts=rdr("Discounts")\r
+ if category<>lastCategory then\r
+ if not IsNothing(lastCategory) then\r
+ AddRow("Subtotal",subtotals(0),subtotals(1),"Subtotal")\r
+ end if\r
+ ex1.AddDataRow\r
+ ex1.AddCell(new SimpleGrid.TextCell(category, "CatHead"))\r
+ ex1.AddCell(new SimpleGrid.TextCell("", "CatHead"))\r
+ ex1.AddCell(new SimpleGrid.TextCell("", "CatHead"))\r
+ ex1.AddCell(new SimpleGrid.TextCell("", "CatHead"))\r
+ ex1.AddCell(new SimpleGrid.TextCell("", "CatHead"))\r
+ for i=0 to 1\r
+ subtotals(i)=0\r
+ next\r
+ lastCategory=category\r
+ end if\r
+ subtotals(0)+=Gross\r
+ grandtotals(0)+=Gross\r
+ subtotals(1)+=Discounts\r
+ grandtotals(1)+=Discounts\r
+ AddRow(rdr("ProductName"),Gross,Discounts,"")\r
+ end while\r
+ rdr.Close()\r
+ if not IsNothing(lastCategory) then\r
+ AddRow("Subtotal",subtotals(0),subtotals(1),"Subtotal")\r
+ end if\r
+ AddRow("Grand Total",grandtotals(0),grandtotals(1),"GrandTotal")\r
+End Sub\r
+\r
+sub AddRow(ProductName as String, Gross as Double, Discounts as Double, StyleId as String)\r
+ dim pct as double\r
+ ex1.AddDataRow()\r
+ ex1.AddCell(new SimpleGrid.TextCell(ProductName, StyleId))\r
+ ex1.AddCell(new SimpleGrid.NumberCell(Gross, StyleId & "Number"))\r
+ ex1.AddCell(new SimpleGrid.NumberCell(Discounts, StyleId & "Number"))\r
+ ex1.AddCell(new SimpleGrid.NumberCell(Gross-Discounts, StyleId & "Number"))\r
+ pct=Discounts/Gross\r
+ ex1.AddCell(new SimpleGrid.NumberCell(pct, StyleId & "Percent"))\r
+end sub\r
+\r
+Protected Overrides Sub Render(writer as HTMLTextWriter)\r
+ select case lcase(Request.QueryString("fmt"))\r
+ case "xl": ex1.RenderExcel("ProductSalesSummary.xml")\r
+ case "csv": ex1.RenderDelimited("ProductSalesSummary.csv")\r
+ case else: MyBase.Render(writer) ' output html\r
+ end select\r
+End Sub\r
+\r
+</script>\r
+\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
+<html>\r
+<head>\r
+<title>Rico SimpleGrid-Example 1</title>\r
+\r
+<Rico:LoadClient checkQueryString='notheme' runat='server' />\r
+<link href="../demo.css" type="text/css" rel="stylesheet" />\r
+\r
+\r
+<script type='text/javascript'>\r
+function ExportGridClient() {\r
+ ex1['grid'].printVisible();\r
+}\r
+\r
+function ExportGridServer(ExportType) {\r
+ if (Rico.isIE) {\r
+ location.href+='&fmt='+ExportType;\r
+ } else {\r
+ window.open(location.href+'&fmt='+ExportType);\r
+ }\r
+}\r
+</script>\r
+\r
+</head>\r
+\r
+<body>\r
+\r
+<div id='explanation'>\r
+Base Library: \r
+<script type='text/javascript'>\r
+document.write(Rico.Lib+' '+Rico.LibVersion);\r
+</script>\r
+<hr>\r
+<p><strong>Rico: SimpleGrid with custom headings/no theme</strong></p>\r
+<p>Rico's SimpleGrid is an unbuffered grid - all data exists in the DOM.\r
+It shares many of the same characteristics as Rico's better known LiveGrid.\r
+SimpleGrids have resizable columns, frozen columns on the left, and can use the\r
+same CSS styling as LiveGrids. Sorting and filtering can also be enabled\r
+at the developer's discretion. Unlike LiveGrids, each cell in a SimpleGrid\r
+can be formatted individually.\r
+</div>\r
+\r
+\r
+<div>\r
+<button onclick="ExportGridClient()">Export from client<br>to HTML Table</button>\r
+<button onclick="ExportGridServer('xl')">Export from server<br>to Excel</button>\r
+<button onclick="ExportGridServer('csv')">Export from server<br>to CSV</button>\r
+</div>\r
+\r
+<Rico:SimpleGrid runat='server' id='ex1' frozenColumns='1' HdgRowLines='2'>\r
+ <Rico:Style runat='server' StyleID='DefaultHdg' BackColor="black" ForeColor="white" HorizontalAlign="center" Bold="true" />\r
+ <Rico:Style runat='server' StyleID='CatHead' BackColor="blue" ForeColor="white" bold="true" />\r
+ <Rico:Style runat='server' StyleID='Subtotal' BackColor="#888888" ForeColor="white" bold="true" />\r
+ <Rico:Style runat='server' StyleID='GrandTotal' BackColor="black" ForeColor="white" bold="true" />\r
+ <Rico:Style runat='server' StyleID='Number' NumberFormat="$#,##0" HorizontalAlign="right" />\r
+ <Rico:Style runat='server' StyleID='SubtotalNumber' NumberFormat="$#,##0" HorizontalAlign="right" BackColor="#888888" ForeColor="white" bold="true" />\r
+ <Rico:Style runat='server' StyleID='GrandTotalNumber' NumberFormat="$#,##0" HorizontalAlign="right" BackColor="black" ForeColor="white" bold="true" />\r
+ <Rico:Style runat='server' StyleID='Percent' NumberFormat="0%" HorizontalAlign="right" />\r
+ <Rico:Style runat='server' StyleID='SubtotalPercent' NumberFormat="0%" HorizontalAlign="right" BackColor="#888888" ForeColor="white" bold="true" />\r
+ <Rico:Style runat='server' StyleID='GrandTotalPercent' NumberFormat="0%" HorizontalAlign="right" BackColor="black" ForeColor="white" bold="true" />\r
+\r
+ <Rico:SimpleCol runat='server' heading="Product" width='200' />\r
+ <Rico:SimpleCol runat='server' heading="Gross Sales" />\r
+ <Rico:SimpleCol runat='server' heading="Discounts" />\r
+ <Rico:SimpleCol runat='server' heading="Net Sales" />\r
+ <Rico:SimpleCol runat='server' heading="Avg Discount" width='65' />\r
+</Rico:SimpleGrid>\r
+\r
+</body>\r
+</html>\r