Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by arup datta on Jan 20, 2008 07:34
open dhtmlx forum
dynamic loading xml file

dhtmlcombo with dynamic xml file

my source is given bellow


main.asp


<div id="MyDiv" style="border:1px white; height:160px; width:500px; overflow:auto;border-color:red;">
<table id="table1" width="100%" border="0" background="Image/leftbar6.jpg">


<%
nrs2.Open "select * from treatment where pcode=" &"'"&npcode&"'" & "and tretdate=" &"'"&mdate&"'"& " order by id" , con,3,3
if nrs2.RecordCount=0 Then
nrs2.Close
set nrs=nothing
con.Close
set con=nothing
Response.redirect "newhead.asp"
end if
c=1
if nrs2.eof then
nrs2.MoveFirst
end if

while not nrs2.eof
mdelrow=nrs2("dflag")%>
<tr>
<% if mdelrow="Y" Then %>
<td ><%=c%>.<input type="checkbox" name="delrow<%=c%>" checked="yes" onClick="xxz(delrow<%=c%>,col1_<%=c%>,col2_<%=c%>)"></td>
<% else %>
<td ><%=c%>.<input type="checkbox" name="delrow<%=c%>" onClick="xxz(delrow<%=c%>,col1_<%=c%>,col2_<%=c%>)"></td>
<% end if %>
<td >



<div id="col1_<%=c%>" style="width:200px; height:30px;"></div>

<script>
var z=new dhtmlXCombo("col1_<%=c%>","alfa2",200);
z.enableFilteringMode(true,"db2xml.asp?colname=col1_<%=c%>",true,true);
</script>

</td>

<td ><textarea row="3" col="40" name="col2_<%=c%>"><%=nrs2("doz")%></textarea></td>

</tr>
<%
c=c+1
nrs2.MoveNext
wend
nrs2.Close
set nrs2=nothing

%>

</table>



</div>



here is my db2xml.asp

<head>
<meta http-equiv="Content-Type" content="text/xml" />
</head>
<% Dim objConn, strConnect, strSQL, rs, tb, mdbFile, objFSO, xmlFile, objWrite,c,cnum
cnum=request.querystring("colname")
xmlFile = Server.MapPath("product.xml")
mdbFile = Server.MapPath("pprofile.mdb")

tb = chr(9)

set objFSO = Server.CreateObject( "Scripting.FileSystemObject" )
Set objConn = Server.CreateObject( "ADODB.Connection" )

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdbFile

objFSO.CreateTextFile( xmlFile )
set objWrite = objFSO.OpenTextFile( xmlFile, 2 )

objWrite.WriteLine("<?xml version=""1.0"" ?>")
objWrite.WriteLine("<complete add=true>")



strSQL = "SELECT * FROM product where prdname like '"&trim(cnum)&"%' order by prdname"
Set rs = objConn.Execute(StrSQL)
Do While not rs.EOF
c=rs("id")
objWrite.WriteLine(tb & "<option value="&"'"&Cstr(c)&"'"&">" & rs("prdname") & "</option>")
rs.MoveNext

Loop
objWrite.WriteLine("</complete>")
objWrite.Close()

%>

i have added header as u said

now, its not showing any error
but data is not popolated in combo


pls advice me what to do


thanks in advance
Answer posted by Support on Jan 21, 2008 05:54
><head>
><meta http-equiv="Content-Type" content="text/xml" />
></head>

This will not work. The content type can be set by
<% response.ContentType ="text/xml"  %>