Datagrid is not displayed with XML

Discussion in 'ASP .Net Datagrid Control' started by krallabandi@gmail.com, Nov 25, 2005.

  1. Guest

    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,
     
    , Nov 25, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. brian richards

    Help Datagrid always displayed as disabled

    brian richards, Sep 3, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,391
    brian richards
    Sep 3, 2003
  2. Anna
    Replies:
    1
    Views:
    376
    Joe Fallon
    Feb 26, 2005
  3. boney
    Replies:
    1
    Views:
    603
  4. CFirmino
    Replies:
    1
    Views:
    154
    Alvin Bruney [MVP]
    Apr 4, 2004
  5. Wes-Securitas

    Swedish characters not displayed in datagrid

    Wes-Securitas, Jul 19, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    170
    Wes-Securitas
    Jul 19, 2004
Loading...

Share This Page