-
Explain Microsoft example Treeview Control in ASP
Can someone explain the microsoft example using treeview control.
Primarily the Response write statement with "Char(34)" and answer the question
how does it pick variables???
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Sample Tree Control</TITLE>
</HEAD>
<BODY>
<OBJECT ID="TreeView1" WIDTH=300 HEIGHT=400
CLASSID="CLSID:0713E8A2-850A-101B-AFC0-4210102A8DA7">
<PARAM NAME="_ExtentX" VALUE="7938">
<PARAM NAME="_ExtentY" VALUE="10583">
<PARAM NAME="_Version" VALUE="327682">
<PARAM NAME="LineStyle" VALUE="1">
<PARAM NAME="Style" VALUE="6">
<PARAM NAME="Appearance" VALUE="1">
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
TreeView1.Font.Name = "Arial"
TreeView1.Font.Size = 10
<%
'************ Construct SQL Statement ******************************
sSQL = "SELECT authors.au_id, authors.au_fname + ' ' +
authors.au_lname as 'author', titles.title"
sSQL = sSQL & " FROM authors"
sSQL = sSQL & " JOIN titleauthor ON authors.au_id=titleauthor.au_id"
sSQL = sSQL & " JOIN titles ON titleauthor.title_id =
titles.title_id"
sSQL = sSQL & " ORDER BY authors.au_lname, authors.au_fname,
authors.au_id, titles.title"
'************ Create Connection and Recordset **********************
Set cnnPubs = Server.CreateObject("Adodb.connection")
cnnPubs.open "DSN=pubs", "sa" 'Point to a DSN called PUBS.
Set rstAuthorsTitles = Server.CreateObject("adodb.recordset")
Set rstAuthorsTitles = cnnPubs.execute(sSQL)
'************ Populate the Control ******************************
Dim sTmpAuthorId
sTmpAuthorId = ""
Do While Not rstAuthorsTitles.EOF 'Check for end of recordset.
If rstAuthorsTitles(0) <> sTmpAuthorId Then 'Check for empty or
'the same author_id.
Response.Write "TreeView1.Nodes.Add , , " & Chr(34) &_
rstAuthorsTitles(0) & Chr(34) & "," & Chr(34) &_
rstAuthorsTitles(1) & Chr(34) & chr(10) & chr(13)
'Add author to root node.
sTmpAuthorId = rstAuthorsTitles(0)
End If
'********* Add the titles as a child node to the author *****
Response.Write Chr(10) & "TreeView1.Nodes.Add " & Chr(34) & _
rstAuthorsTitles(0) & Chr(34) & ", 4,," & Chr(34) & _
rstAuthorsTitles(2) & Chr(34) & chr(10) & chr(13)
rstAuthorsTitles.MoveNext
Loop
%>
</SCRIPT>
</BODY>
</HTML>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks