Added 3grids asp & .net examples. ricoQuery.aspx removed, as all AJAX queries in...
[infodrom/rico3] / examples / dotnet / CustTree.aspx
index 81a1326..1c1335e 100644 (file)
@@ -1,38 +1,29 @@
-<%@ Page Language="vb" Debug="true" %>\r
-<%@ Register TagPrefix="Rico" TagName="XmlWriter" Src="../../plugins/dotnet/ricoResponse.ascx" %>\r
+<%@ Page Language="vb" %>\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
-dim RequestId as string\r
-dim parent as string\r
-\r
 Sub Page_Load(Sender As object, e As EventArgs)\r
-  Response.CacheControl = "no-cache"\r
-  Response.AddHeader("Pragma", "no-cache")\r
-  Response.Expires = -1\r
-  Response.ContentType="text/xml"\r
-  \r
-  RequestId=trim(Request.QueryString("id"))\r
-  parent=trim(Request.QueryString("Parent"))\r
+  Dim parent as String = Left(Request.QueryString("Parent"),1)  ' first character of company name\r
 \r
-  if RequestId="" then\r
-    XmlObj.ErrorMsg="No ID provided!"\r
-  elseif not app.OpenDB() then\r
-    XmlObj.ErrorMsg=app.LastErrorMsg\r
+  if not app.OpenDB() then\r
+    TreeData.ErrorMsg=app.LastErrorMsg\r
   else\r
-    XmlObj.dbConnection=app.dbConnection\r
-    XmlObj.dbDialect=app.dbDialect\r
+    TreeData.dbConnection=app.dbConnection\r
     if parent <> "" then\r
-      XmlObj.sqlText="SELECT '" & parent & "',CustomerID,CompanyName,'L',1 FROM customers where CompanyName like '" & parent & "%'"\r
+      ' get the leaf nodes - customer names starting with the letter contained in parent\r
+      TreeData.sqlText="SELECT '" & parent & "',CustomerID,CompanyName,'L',1 FROM customers where CompanyName like '" & parent & "%'"\r
     else\r
-      XmlObj.WriteTreeRow("","root","Customer names starting with...","C",0)\r
-      XmlObj.sqlText="SELECT distinct 'root',left(CompanyName,1),left(CompanyName,1),'C',0 FROM customers"\r
+      ' this is a request for the root node\r
+      TreeData.WriteTreeRow("","root","Customer names starting with...","C",0)\r
+      ' return a list of the first letters of the company names\r
+      TreeData.sqlText="SELECT distinct 'root',left(CompanyName,1),left(CompanyName,1),'C',0 FROM customers"\r
     end if\r
   end if\r
 End Sub\r
 \r
 </script>\r
 \r
-<Rico:XmlWriter id="XmlObj" runat="server"/>\r
+<Rico:TreeResponse id="TreeData" runat="server"/>\r