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,
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,