0

I have a devexpress gridcontrol and loaded a Xml .. If XMl has attributes then datasource getting loaded correctly .. else it fails and throws exception

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



       DataSet dsnew = new DataSet();
        StreamReader sReader = new StreamReader("C:\\test.xml");
        string sRdr = sReader.ReadToEnd();
        if (!string.IsNullOrEmpty(sRdr))
        {
            dsnew.ReadXml("C:\\test.xml");
                  if (dsnew.Tables.Count > 0)
            {
                gridControl1.DataSource = dsnew.Tables[0];
                SetGridView();
            }

I am getting EXCEPTIOn only if attribute is missing

Aravind Srinivas
  • 251
  • 3
  • 8
  • 15

1 Answers1

0

I never find it difficult to bind xmlDataSource to GridContorl Of Devexpress. Here is my code

            string strXMLPath = "Your Path Of Xml"; /* c://myxml.xml */
            FileStream fs = new FileStream(strXMLPath, FileMode.Open, FileAccess.Read);
            ds = new DataSet();
            ds.ReadXml(fs);
            fs.Dispose();
            grdControl.DataSource = ds.Tables[0];
Rajeev Kumar
  • 4,901
  • 8
  • 48
  • 83
  • http://www.devexpress.com/Support/Center/Question/Details/Q485368 .. see this download it and see the image and check with - u can able to find the differenc – Aravind Srinivas Apr 01 '13 at 09:29