Datagrid is not displayed with XML

K

krallabandi

Hi.


I use two different approaches to bind data to my DataGrid. One is to
get
the data from a database, like this:


oleDbDataAdapter = New OleDbDataAdapter(strSqlCostItem,
oleDbConnection)
oleDbDataAdapter.Fill(dataSet, "ITEM")
dgItem.DataSource = dataSet.Tables("ITEM")
dgItem.DataBind()


The other approach is to use xml, like this:


byteXml = myWebService.ReturnXmlAsByte()
memoryStream = New MemoryStream(byteXml)
dataSetLocal = New DataSet()
dataSetLocal.ReadXml(memoryStream)
dgItem.DataSource = dataSetLocal.Tables("ITEM")
dgItem.DataBind()


With the first approach the DataGrid is visible even if the sql returns
no
records from the DB. No records are displayed, but all the column's
headertext are showing. But if the webservice returns just an empty
node the
DataGrid doesn't show at all. How can I make it show? Can I format
the xml
a certain way? I've tried having all the elements there, but without
any
data. That didn't work, it showed an empty record in the DataGrid, and
I
don't want an empty record. I just want the headertext to show.


Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top