[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Datagrid Question

Hi,

I'm returing a dataset from a webservice to a Datagrid using:

        dsOut.ReadXml(stream)
        DataGrid1.DataSource = dsOut

When the grid populates, I see one item called "item" with a plus sign, expanding this gives me the data I want, how do avoid the initial item being displayed and automatically expand to "item"

Regards
Plucka
0
Plucka
Asked:
Plucka
  • 2
  • 2
1 Solution
 
rrbeckerCommented:
Hi Plucka,

What about trying to load all 'Child Nodes'

example: DataGrid1.DataSource = dsOut.childNodes(1)

Actually you may have to iterate through the XML and load the data from there:

example:
---------------------------------------------------------------------------------
For I = 0 To ResultDocument.childNodes.Length - 1
        If ResultDocument.childNodes(I).hasChildNodes = True Then
            RtnVal = LoadXMLChildNode(ResultDocument.childNodes(I), CStr(ResultDocument.NodeName))
        Else
            XMLNodeNameArray(MaxXMLNodes) = CStr(ResultDocument.NodeName)
            XMLNodeValueArray(MaxXMLNodes) = CStr(ResultDocument.childNodes(I).Text)

            MaxXMLNodes = MaxXMLNodes + 1
            ReDim Preserve XMLNodeValueArray(MaxXMLNodes)
            ReDim Preserve XMLNodeNameArray(MaxXMLNodes)

        End If
    Next I
-----------------------------------------------------------------------------

This is just a snippet from something that I have used in the past. It is not intended to be anything more than just some food for thought.....


Hope this helps a little

rrbecker
0
 
PluckaAuthor Commented:
Ahh,

Yes good food, did make me think about specifying the node on the dataset.

This works.

DataGrid1.DataSource = dsOut.childNodes(1).Tables(0)

Regards
Plucka
0
 
PluckaAuthor Commented:
Sorry,

I mean this.

DataGrid1.DataSource = dsOut.Tables(0)

Regards
Plucka
0
 
rrbeckerCommented:
Hi Plucka,

Glad I could help. I have received plenty of help from EE myself. I am glad that I could return the favor.

Thanks, and have 'Fun'....


rrbecker
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now