DhtmlxGrid PLEASE SEND ME URGENT !!!!!!!!!!!!!!!!!!!!!

Please Rectify this code i want to show the run time generated xml file in the dhtmlxgrid



This is my daldatalink.cs file which is in app_code



using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.UI;

using System.Xml;

using System.Collections.Specialized;

using System.Collections;

using PIInfosoft.Framework.Data;

using Microsoft.Xml.XQuery;

using System.IO;

using System.Data.SqlClient;



///



/// Summary description for dalDataLink

///


///

namespace PI.Dal.Package

{

public class dalDataLink

{

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[“SqlServer”].ToString());



protected XmlDocument xmlDoc = null;

//protected IDbConnection conn = null;

protected String tag = “”;

protected string strICode = “”;

protected string strPageName = “”;

public dalDataLink( String xmlFile,string pstrICode)

{

this.xmlDoc = new XmlDocument();

this.xmlDoc.Load(xmlFile);

strICode = pstrICode;

strPageName = “Package”;

}

~dalDataLink()

{ }





private String PrintXMLHeader()

{

return this.PrintXMLHeader(“data”, “”);

}

private String PrintXMLHeader(String tag, String add)

{

this.tag = tag;

return “<?xml version=\"1.0\" encoding=\"UTF-8\"?><” + tag + " " + add + “>”;



}

private String PrintXMLFooter()

{

return “</” + this.tag + “>”;

}

///

///

///


///

///

///

///

private String PrintAction(String action, String sid, String tid)

{

return “”;

}











public String getXML()

{

String res = “”;

String type = (xmlDoc.DocumentElement.Attributes[“type”] != null) ? xmlDoc.DocumentElement.Attributes[“type”].Value : “”;

switch (type)

{

case “tree”:

break;

default:

if(strPageName==“Package”)

{

res += this.PrintXMLHeader(“rows”, “”);

res += " " +

" Sr No. " +

" vcItineraryCode " +

" From Date " +

" From Place " +

" To Place " +

" Mode " +

" OverNight " +

" To Date " +

" stayNight " +

" From PlaceCode " +

" To PlaceCode " +

" " +

" px " +

" " +

" “;

res += this.GetXmlGrid();

}

break;

}

res += this.PrintXMLFooter();

//conn.Close();

return res;

}

///

///

///


///

private String GetXmlGrid()

{

String res = “”;

String where = xmlDoc.GetElementsByTagName(“where”)[0].InnerText;

if (strPageName == “Package”)

{



String sql = “SELECT * FROM " + xmlDoc.GetElementsByTagName(“table”)[0].Attributes[“name”].Value;

if (where != “” && strICode != “”)

sql += " WHERE " + where + “=’” + strICode.Trim() + “’ order by inSrNo”;

SqlCommand cmd = new SqlCommand(sql, con);

cmd.Connection.Open();

IDataReader r = cmd.ExecuteReader();

while (r.Read())

{

res += “<row id=”” + r[xmlDoc.GetElementsByTagName(“key”)[0].Attributes[“name”].Value] + “”>”;



foreach (XmlElement param in xmlDoc.GetElementsByTagName(“param”))

{

if (param.Attributes[“name”].Value == “inSrNo”)

{

res += “” + r[0] + “”;

}

else

{

res += “” + r[param.Attributes[“name”].Value] + “”;

}

}



res += “”;

}



cmd.Connection.Close();

return res;

}

else{return res;}



}







}

}









This is my bllpackage.cs file







using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;



using PI.Dal.Package;

///

/// Summary description for BllPackage

///


namespace PI.Bll.package

{

public class BllPackage

{

protected String strFileName = “”;

protected string strPICode = “”;

protected string strPageName = string.Empty;

public BllPackage(String xmlFile, string pstrICode)

{

this.strFileName = xmlFile;

this.strPageName = “Package”;

strPICode = pstrICode;

}

~BllPackage()

{

}





public String getXML()

{



PI.Dal.Package.dalDataLink objdaldatalink = new PI.Dal.Package.dalDataLink(strFileName, strPICode);

String res = objdaldatalink.getXML();

return res;

}

}

}







this is my package





























Wait while processing Processing



Select Package

  <asp:DropDownList ID=“ddlPacakageNames” Width=“264px” runat=“server” AutoPostBack=“True” onchange=“getddlseletedvalue();” >

asp:ListItemSelect Package</asp:ListItem>



</asp:DropDownList>

<asp:Label ID=“Label1” runat=“server” Text=“Label”></asp:Label>


Note : Do not press F5(Refresh) or Back Button u lost all data

<%----%>










<%--
--%>





mygrid = new dhtmlXGridObject('gridbox');
mygrid.imgURL='http://'+location.host+'/t2india/Images/imgs/';

var x="pi-001"
mygrid.loadXML("http://"+location.host+"/t2india/PackageLoadData.aspx?PCode="+ x + "");

     mygrid.init();




when page is loaded then ERROR IS LOADXML ,INCORRECT XML


THIS IS MY XML GENERATION FILE


<?xml version="1.0" encoding="utf-8"?>


grid_id
c0
c1
c2
c3
c4
c5
c6
c7
c8
c9
c10

vcItineraryCode

!nativeeditor_status

Please be sure that XML data outputed with correct content type - text/xml
Also, you can use debug version of dhtlmxcommon ( or debug of dataprocessor ) to check exact server side response, which may contain info about some error.
dhtmlx.com/docs/products/kb/inde … tmlxcommon