views:

7

answers:

1

I have a grid panel having a datastore to load data. The Datastore has a asp.net webpagewith base params as the URL. Based on the querystring and baseparam values I am generating a XML string and returning the data as XMLStrilng by response.write.

But my XMLReader is not loading the data. If I save the same string as XML file and load the store, the reader loads the data. HOw do we return the XML data from a asp.net webpage to the XMLData reader??

Any help will be appriciated.

MY Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0     Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
 <script type="text/javascript" src="extjs/ext-all-debug.js"></script>
 <link rel="stylesheet" href="extjs/resources/css/ext-all.css"/>
   <script type="text/javascript" src="PLScript.js"></script>

</head>
<body>
</body>
</html>

Ext.onReady(function() {
 var store = new Ext.data.Store({
        // load using HTTP  
        //url: 'RT.xml',  
         url: abc.aspx?EXTJSAction=LoadXML',  
         baseParams: { DataId: '1' },  
        // the return will be XML, so lets set up a reader
        reader: new Ext.data.XmlReader({  
            // records will have an "Item" tag  
        record: 'Rows',  
        id: 'Code'              
    }, [  
    // set up the fields mapping into the xml doc  
    // The first needs mapping, the others are very basic  
           {name: 'DepartmentCode', mapping: 'DepartmentCode' },  
           'Code', 'Description'  

       ])  
});  

 var grid = new Ext.grid.GridPanel({  
        store: store,
    columns: [
         { header: "Division", width: 150, dataIndex: DepartmentCode, sortable: true },
    { header: "Description", width: 210, dataIndex: Description, sortable: true         ],
    renderTo: Ext.getBody(),
    height: 200
});

store.load();
 });

});

 protected void Page_Load(object sender, EventArgs e)
    {
    switch (Request.QueryString["EXTJSAction"].ToString())
            {
  case "LoadXML'":
                    {
   //Code to generate XML Srting  
 Response.Write(strReturn);  
                        Response.End();  
                    }
                    break;
            }
        }

Please ignore any syntax error, since this is working in my machine with real data. My question is how do I return the data from my asp.net page call? Also as I said the xmlstring if stored as a xml file it is working.

Thansk for the help in advance.

A: 

I would suggest that you add add a listener to the DataStore's exception or loadException events. The various arguments passed to the listener will most likely indicate what's going on.

John Gordon