dhtmlXGridFromTable not working for me

I am trying to use dhtmlXGridFromTable and not having any luck at all. We are using asp (I know, it’s very old technology) to generate our pages. We are just getting started with AJax and also wanted to incorporate these DHTMLX tools.



My page that’s not working is as follows…



____________________________________________________________________________________________















<% Session(“PC”) = request(“PC”) %>







<%

Set cn = Server.CreateObject(“ADODB.Connection”)

cn.Open Session(“AppConn”)



sql = "Select * from base "

sql = sql & "where 1=1 "

sql = sql & “and PerfCharge = '” & request(“PC”) & "’ "

sql = sql & "and origin = ‘Input’ "

sql = sql & "and lbrType <> ‘NL’ "

sql = sql & “order by emplName”

Set rs = Server.CreateObject(“ADODB.Recordset”)

rs.CursorLocation = adUseClient

rs.Open SQL, cn, 2, 3

%>









<%

while not rs.EOF

%>







<%

rs.movenext

wend

%>



Employee



<%=rs(“EmplName”)%>



<%

%>



____________________________________________________________________________________________





It’s a very simply HTML table that I was hoping to convert to dhtmlXGrid. Once I get it working, I will elaborate on the table. For now, I just want it to display to confirm that it’s working. So far, the output is exactly the same as just a normal HTML table. And, when I debug it, the message is as follows…



obj has no properties

dhtmlXGridFromTable(null, undefined)dhtmlxgrid_start… (line 13)

[Break on this error] w.setAttribute(“width”,obj.getAttribute(“gridWidth”)||(obj.offsetWi…



Any help would be much appreciated.

In your code snippet the dhtmlXGridFromTable command executed before table really rendered, so the command can’t locate it and convert to grid.
Problem can be solved by
    - moving command after code which output HTML code of table
or
    - adding code, to launch conversion only after document loading