Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Manjusha on Apr 10, 2008 04:30
open dhtmlx forum
How to insert hyperlink for Column Header

In the table on click of colmn headers user defined sort function should be called. So I want to give hyperlink to the column header by using anchor tag. But it is giving me errors. Below is my code. I think I am wrong in syntax. Please help me ASAP.

In my ASP file I write like this:

Response.Write "<script type=""text/javascript"">"
Response.Write "var sXML='<?xml version=\""1.0\"" encoding=\""UTF-8\""?><rows><head>"

Response.Write "<column width=""100"" type=""" & sFieldType & """ align=""left"" color=""white"" sort=""na"">" & _
"<![CDATA[<a href=""javascript:Sort(""" & sSortString & """, """ & ASC & """);"">" & sFieldName & "</a>]]></column>"
........
........
Response.write "<rows>';"

In dhtmlGrid.js I will load XML like this:

mygrid.loadXMLString(sXML);
Answer posted by Support on Apr 10, 2008 05:09
The syntax of XML is correct, the code must render correct link, the same code used from static XML works fine ( sample attached )
Please beware that if you output directly in js variable any single quote or new line in output will break js code.


Attachments (1)
sample.zip1.38 Kb
Answer posted by Hans on May 16, 2008 22:34

Depending on the version and response buffer setting of ASP, you must break Response.Write "<script " to something like Response.Write "<scr" Response.Write "ipt ".
Or the js code breaks.
This was an issue for me a while back.
Maybe it can help you.
/Hans