.net server control is almost feature complete and functional. All .net examples...
[infodrom/rico3] / examples / dotnet / ex2nosession.aspx
index 1a3ae1f..36e4444 100644 (file)
@@ -1,41 +1,16 @@
-<%@ Page Language="VB" ResponseEncoding="iso-8859-1" Debug="true" validateRequest="false" %>\r
-<%@ Register TagPrefix="Rico" TagName="LiveGrid" Src="../../plugins/dotnet/LiveGrid.ascx" %>\r
-<%@ Register TagPrefix="Rico" TagName="Column" Src="../../plugins/dotnet/GridColumn.ascx" %>\r
-<%@ Register TagPrefix="Rico" TagName="Panel" Src="../../plugins/dotnet/GridPanel.ascx" %>\r
-<%@ Register TagPrefix="Rico" TagName="sqlCompatibilty" Src="../../plugins/dotnet/sqlCompatibilty.ascx" %>\r
-<%@ Register TagPrefix="Rico" TagName="ricoResponse" Src="../../plugins/dotnet/ricoResponse.ascx" %>\r
-<%@ Register TagPrefix="My" TagName="LoadRicoClient" Src="LoadRicoClient.ascx" %>\r
+<%@ Page Language="VB" ResponseEncoding="iso-8859-1" validateRequest="false" %>\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
-\r
 <script runat="server">\r
 \r
 Sub Page_Load(Sender As object, e As EventArgs)\r
   Session.Timeout=60\r
   dim arEmpSql as string() = {"LastName","', '","FirstName"}\r
   dim oSqlCompat=new sqlCompatibilty(app.dbDialect)\r
-  ex8n.columns(ex8n.ColIndex("EmployeeID")).SelectSql="select EmployeeID," & oSqlCompat.Concat(arEmpSql,false) & " from employees order by LastName,FirstName" \r
-  ex8n.dataProvider=Request.ServerVariables("SCRIPT_NAME")\r
-  app.OpenGridForm(ex8n)\r
-End Sub\r
-\r
-Protected Overrides Sub Render(writer as HTMLTextWriter)\r
-  select case ex8n.action\r
-    case "table": \r
-      RespObj.RenderFlag=false\r
-      MyBase.Render(writer)\r
-    case "ins":   ex8n.InsertRecord(writer)\r
-    case "upd":   ex8n.UpdateRecord(writer)\r
-    case "del":   ex8n.DeleteRecord(writer)\r
-    case "query":\r
-      RespObj.dbConnection=app.dbConnection\r
-      RespObj.dbDialect=app.dbDialect\r
-      RespObj.sendDebugMsgs=true   ' true for development, false for production\r
-      RespObj.LogSqlOnError=true   ' true for development, false for production\r
-      RespObj.oParse=ex8n.ParseClone()\r
-      RespObj.RunQuery(writer)\r
-  end select\r
+  EmployeeID.SelectSql="select EmployeeID," & oSqlCompat.Concat(arEmpSql,false) & " from employees order by LastName,FirstName" \r
+  app.OpenGridForm(nosession)\r
 End Sub\r
 \r
 </script>\r
@@ -45,26 +20,10 @@ End Sub
 <head>\r
 <title>Rico LiveGrid-Example 2 (editable)</title>\r
 \r
-<My:LoadRicoClient id='initlibs' runat='server' modules='Calendar,Tree' />\r
+<Rico:LoadClient checkQueryString='true' runat='server' />\r
 <link href="../demo.css" type="text/css" rel="stylesheet" />\r
 \r
-<script type='text/javascript'>\r
-\r
-// ricoLiveGridForms will call orders_FormInit right before grid & form initialization.\r
-\r
-function ex8_FormInit() {\r
-  var cal=new Rico.CalendarControl("Cal");\r
-  Rico.EditControls.register(cal, Rico.imgDir+'calarrow.png');\r
-  \r
-  var CustTree=new Rico.TreeControl("CustomerTree","CustTree.aspx");\r
-  Rico.EditControls.register(CustTree, Rico.imgDir+'dotbutton.gif');\r
-}\r
-</script>\r
-\r
 <style type="text/css">\r
-div.ricoLG_outerDiv thead .ricoLG_cell, div.ricoLG_outerDiv thead td, div.ricoLG_outerDiv thead th {\r
-       height:1.5em;\r
-}\r
 div.ricoLG_cell {\r
   white-space:nowrap;\r
 }\r
@@ -74,48 +33,40 @@ div.ricoLG_cell {
 \r
 <body>\r
 \r
-<table id='explanation' border='0' cellpadding='0' cellspacing='5' style='clear:both'><tr valign='top'><td>\r
+<div id='explanation'>\r
 Base Library: <script type='text/javascript'>document.write(Rico.Lib+' '+Rico.LibVersion);</script>\r
 <hr>The data on this grid can be edited using pop-up forms. \r
 Just click on a grid cell and then select Edit, Delete, or Add from the pop-up menu. \r
 Updates are disabled on the database, so you will get an error message if you try to save.\r
-<p>Rather than requesting data from RicoQuery, this page is able to process the AJAX\r
-data requests itself. No session variables are used.\r
-</td><td>\r
-<script type='text/javascript'><!--\r
-google_ad_client = 'pub-7218597156507462';\r
-/* 125x125, created 5/11/09 */\r
-google_ad_slot = '9298106441';\r
-google_ad_width = 125;\r
-google_ad_height = 125;\r
-//-->\r
-</script>\r
-<script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'></script>\r
-</td></tr></table>\r
+<p>Each request for data is processed separately. No session variables are used.\r
+The disadvantage is that the query must be completely rebuilt every time - and just building\r
+the query requires an additional query to the database to get table metadata (primary keys, etc).\r
+This overhead is not required when session variables are used.\r
+</div>\r
 <p><strong>Orders Table (without sessions)</strong></p>\r
 \r
 \r
-<Rico:LiveGrid runat='server' id='ex8n' formView='true' TableName='orders' DefaultSort='OrderID' FilterLocation='-1' sessions='false'>\r
-<GridColumns>\r
-  <Rico:Panel runat='server' heading='Basic Info' />\r
-  <Rico:Column runat='server' heading='Order#'        width='60'  ColName='OrderID'      EntryType='B' ColData='<auto>' ConfirmDeleteColumn='true' />\r
-  <Rico:Column runat='server' heading='Customer'      width='160' ColName='CustomerID'   EntryType='CL' InsertOnly='true' SelectCtl='CustomerTree' SelectSql="select CustomerID,CompanyName from customers order by CompanyName" filterUI='t' />\r
-  <Rico:Column runat='server' heading='Sales Person'  width='140' ColName='EmployeeID'   EntryType='SL' filterUI='s' />\r
-  <Rico:Column runat='server' heading='Order Date'    width='100' ColName='OrderDate'    EntryType='D' ColData='Today' SelectCtl='Cal' />\r
-  <Rico:Column runat='server' heading='Required Date' width='100' ColName='RequiredDate' EntryType='D' ColData='Today' SelectCtl='Cal' />\r
-  <Rico:Column runat='server' heading='Net Sale'      width='80'  format='DOLLAR'        Formula='select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID' />\r
-\r
-  <Rico:Panel runat='server' heading='Ship To' />\r
-  <Rico:Column runat='server' heading='Name'        width='150' ColName='ShipName'       EntryType='B' />\r
-  <Rico:Column runat='server' heading='Address'     width='150' ColName='ShipAddress'    EntryType='B' />\r
-  <Rico:Column runat='server' heading='City'        width='80'  ColName='ShipCity'       EntryType='B' filterUI='s' />\r
-  <Rico:Column runat='server' heading='Region'      width='80'  ColName='ShipRegion'     EntryType='T' />\r
-  <Rico:Column runat='server' heading='Postal Code' width='80'  ColName='ShipPostalCode' EntryType='T' />\r
-  <Rico:Column runat='server' heading='Country'     width='90'  ColName='ShipCountry'    EntryType='N' filterUI='s' control="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{11}','_blank')" />\r
-</GridColumns>\r
-</Rico:LiveGrid>\r
-\r
-<Rico:ricoResponse id="RespObj" runat="server" />\r
+<Rico:LiveGridEdit runat='server' id='nosession' DefaultSort='OrderID' FilterLocation='-1' sessions='false'>\r
+  <Rico:CalendarControl runat='server' id='Cal' icon='rico-icon rico-calarrow' />\r
+  <Rico:TreeControl runat='server' id='CustomerTree' icon='rico-icon rico-dotbutton' source='CustTree.aspx' />\r
+\r
+  <Rico:Table runat='server' TblName='orders' />\r
+  <Rico:ColumnGroup runat='server' heading='Basic Info' />\r
+  <Rico:EditCol runat='server' heading='Order#'        width='60'  ColName='OrderID'      EntryType='B' ColData='<auto>' ConfirmDeleteColumn='true' />\r
+  <Rico:EditCol runat='server' heading='Customer'      width='160' ColName='CustomerID'   EntryType='CL' InsertOnly='true' SelectCtl='CustomerTree' SelectSql="select CustomerID,CompanyName from customers order by CompanyName" filterUI='t' />\r
+  <Rico:EditCol runat='server' heading='Sales Person'  width='140' ColName='EmployeeID'   EntryType='SL' filterUI='m' id='EmployeeID' />\r
+  <Rico:EditCol runat='server' heading='Order Date'    width='100' ColName='OrderDate'    EntryType='D' ColData='Today' SelectCtl='Cal' />\r
+  <Rico:EditCol runat='server' heading='Required Date' width='100' ColName='RequiredDate' EntryType='D' ColData='Today' SelectCtl='Cal' />\r
+  <Rico:FormulaCol runat='server' heading='Net Sale'   width='80'  DataType='DOLLAR'      Formula='select sum(UnitPrice*Quantity*(1.0-Discount)) from order_details d where d.OrderID=t.OrderID' />\r
+\r
+  <Rico:ColumnGroup runat='server' heading='Ship To' />\r
+  <Rico:EditCol runat='server' heading='Name'        width='150' ColName='ShipName'       EntryType='B' />\r
+  <Rico:EditCol runat='server' heading='Address'     width='150' ColName='ShipAddress'    EntryType='B' />\r
+  <Rico:EditCol runat='server' heading='City'        width='120' ColName='ShipCity'       EntryType='B' filterUI='m' />\r
+  <Rico:EditCol runat='server' heading='Region'      width='80'  ColName='ShipRegion'     EntryType='T' />\r
+  <Rico:EditCol runat='server' heading='Postal Code' width='80'  ColName='ShipPostalCode' EntryType='T' />\r
+  <Rico:EditCol runat='server' heading='Country'     width='90'  ColName='ShipCountry'    EntryType='N' filterUI='s' control="new Rico.TableColumn.link('http://en.wikipedia.org/wiki/{11}','_blank')" />\r
+</Rico:LiveGridEdit>\r
 \r
 </body>\r
 </html>\r