Using Classic ASP - Can't Get Grid to Display
I would love to pay to use this software but until I can get it to work... I simply cannot get the grid to display in a browser (I've tested on Firefox, IE, even Safari in case it was a browser issue) - here's my code for classic ASP - can anyone tell me what I'm doing wrong? I've scoured the Forum, I've looked at documentation, I'm stumped (and I'm sure it's something basic I've overlooked) - any help would be greatly, greatly appreciated!
<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/Nav/Include.inc"-->
<!--#include virtual="/Connections/conn_SQL_Site.asp" -->
<%
Dim oRecordset
Dim oRecordset_cmd
Dim oRecordset_numRows
Set oRecordset_cmd = Server.CreateObject ("ADODB.Command")
oRecordset_cmd.ActiveConnection = MM_conn_SQL_Site_STRING
oRecordset_cmd.CommandText = "SELECT * FROM dbo.Pictorials_Pictorial ORDER BY AEMID ASC"
oRecordset_cmd.Prepared = true
Set oRecordset = oRecordset_cmd.Execute
' encodes control characters for javascript
function aw_string(s)
s = Replace(s,"\","\\")
s = Replace(s,"""","\""") 'replace javascript control characters - ", \
rem s = Replace(s,vbCr,"\r")
rem s = Replace(s,vbLf,"\n")
aw_string = """" & s & """"
end function
' returns the field names from the recordset formatted as javascript array
function aw_headers(oRecordset)
Dim i, count, headers()
count = oRecordset.fields.count
ReDim headers(count-1)
For i=0 to count-1
headers(i) = aw_string(oRecordset(i).name)
Next
Response.write("[" & Join(headers, ", ") & "];")
end function
' returns the recordset data formatted as javascript array
function aw_cells(oRecordset)
Dim i, col_count, row_count, columns(), rows()
row_count = 0
col_count = oRecordset.fields.count
ReDim columns(col_count-1)
Do while (Not oRecordset.eof)
For i=0 to col_count-1
columns(i) = aw_string(oRecordset(i))
Next
ReDim preserve rows(row_count)
rows(row_count) = vbTab & "[" & Join(columns, ", ") & "]"
row_count = row_count + 1
oRecordset.MoveNext
Loop
Response.write("[" & vbNewLine & Join(rows, "," & vbNewLine) & vbNewLine & "];" & vbNewLine)
end function
%>
<html>
<head>
<body>
<title>ActiveWidgets Examples</title>
<style>body {font: 12px Tahoma}</style>
<!-- include links to the script and stylesheet files and I do have everything foldered in the same place -->
<script src="aw.js"></script>
<link href="aw.css" rel="stylesheet" />
<!-- change default styles, set control size and position -->
<style>
#myGrid {height: 500px}
</style>
</head>
<body>
<h3>ASP classic - VBScript, ADO</h3>
<p>Make VBScript functions returning the data formatted as javascript arrays,<br />
Insert the results inside Javascript data block - test</p>
<p><%=(oRecordset.Fields.Item("title").Value)%></p> This displays so I am connecting to the dbase
<!-- insert control tag -->
<span id="myGrid"></span>
<!-- add data block -->
<%= aw_headers(oRecordset) %> I can see this output
<%= aw_cells(oRecordset) %>I cannot see this output
<script language="JavaScript">
// insert javascript arrays produced by ASP functions
var myHeaders = <%= aw_headers(oRecordset) %>
var myCells = <%= aw_cells(oRecordset) %>
// create grid control
var grid = new AW.UI.Grid;
// assign the grid id (same as placeholder tag above)
grid.setId("myGrid");
// set grid text
grid.setHeaderText(myHeaders);
grid.setCellText(myCells);
//grid.setCellText(true);
grid.setCellEditable(true);
// set number of columns/rows
grid.setColumnCount(myHeaders.length);
grid.setRowCount(myCells.length);
// write grid to the page
obj.setCellText(myCells);
obj.setColumnCount(4);
obj.setRowCount(5);
grid.refresh();
</script>
</body>
</html>
<%
oRecordset.close
%>
<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/Nav/Include.inc"-->
<!--#include virtual="/Connections/conn_SQL_Site.asp" -->
<%
Dim oRecordset
Dim oRecordset_cmd
Dim oRecordset_numRows
Set oRecordset_cmd = Server.CreateObject ("ADODB.Command")
oRecordset_cmd.ActiveConnection = MM_conn_SQL_Site_STRING
oRecordset_cmd.CommandText = "SELECT * FROM dbo.Pictorials_Pictorial ORDER BY AEMID ASC"
oRecordset_cmd.Prepared = true
Set oRecordset = oRecordset_cmd.Execute
' encodes control characters for javascript
function aw_string(s)
s = Replace(s,"\","\\")
s = Replace(s,"""","\""") 'replace javascript control characters - ", \
rem s = Replace(s,vbCr,"\r")
rem s = Replace(s,vbLf,"\n")
aw_string = """" & s & """"
end function
' returns the field names from the recordset formatted as javascript array
function aw_headers(oRecordset)
Dim i, count, headers()
count = oRecordset.fields.count
ReDim headers(count-1)
For i=0 to count-1
headers(i) = aw_string(oRecordset(i).name)
Next
Response.write("[" & Join(headers, ", ") & "];")
end function
' returns the recordset data formatted as javascript array
function aw_cells(oRecordset)
Dim i, col_count, row_count, columns(), rows()
row_count = 0
col_count = oRecordset.fields.count
ReDim columns(col_count-1)
Do while (Not oRecordset.eof)
For i=0 to col_count-1
columns(i) = aw_string(oRecordset(i))
Next
ReDim preserve rows(row_count)
rows(row_count) = vbTab & "[" & Join(columns, ", ") & "]"
row_count = row_count + 1
oRecordset.MoveNext
Loop
Response.write("[" & vbNewLine & Join(rows, "," & vbNewLine) & vbNewLine & "];" & vbNewLine)
end function
%>
<html>
<head>
<body>
<title>ActiveWidgets Examples</title>
<style>body {font: 12px Tahoma}</style>
<!-- include links to the script and stylesheet files and I do have everything foldered in the same place -->
<script src="aw.js"></script>
<link href="aw.css" rel="stylesheet" />
<!-- change default styles, set control size and position -->
<style>
#myGrid {height: 500px}
</style>
</head>
<body>
<h3>ASP classic - VBScript, ADO</h3>
<p>Make VBScript functions returning the data formatted as javascript arrays,<br />
Insert the results inside Javascript data block - test</p>
<p><%=(oRecordset.Fields.Item("title").Value)%></p> This displays so I am connecting to the dbase
<!-- insert control tag -->
<span id="myGrid"></span>
<!-- add data block -->
<%= aw_headers(oRecordset) %> I can see this output
<%= aw_cells(oRecordset) %>I cannot see this output
<script language="JavaScript">
// insert javascript arrays produced by ASP functions
var myHeaders = <%= aw_headers(oRecordset) %>
var myCells = <%= aw_cells(oRecordset) %>
// create grid control
var grid = new AW.UI.Grid;
// assign the grid id (same as placeholder tag above)
grid.setId("myGrid");
// set grid text
grid.setHeaderText(myHeaders);
grid.setCellText(myCells);
//grid.setCellText(true);
grid.setCellEditable(true);
// set number of columns/rows
grid.setColumnCount(myHeaders.length);
grid.setRowCount(myCells.length);
// write grid to the page
obj.setCellText(myCells);
obj.setColumnCount(4);
obj.setRowCount(5);
grid.refresh();
</script>
</body>
</html>
<%
oRecordset.close
%>
lb1
February 20,