0

Team -

Please forgive my ignorance here, I am very new to xml coding. Basic situation is if I run the following code:

Dim feedXML As XDocument = XDocument.Load("c:\Feeds.xml")
        Dim bubba = From Feedmain In feedXML.Descendants("Feed") _
        Where (Feedmain.Attribute("status") Is Nothing) OrElse (Feedmain.Attribute("status").Value <> "disabled") _
        Select Name = Feedmain.Element("Name").Value, _
        Url = Feedmain.Element("otherinfo").Element("Url").Value

I can later bind the data into a gridview and get two lovely columns of text. But I don't want two columns, I want one soooooooo. I do this.

Dim feedXML As XDocument = XDocument.Load("c:\Feeds.xml")
        Dim bubba = From Feedmain In feedXML.Descendants("Feed") _
        Where (Feedmain.Attribute("status") Is Nothing) OrElse (Feedmain.Attribute("status").Value <> "disabled") _
        Select Name = Feedmain.Element("Name").Value

Then when I bind to my datagridview I get a single column but it is giving me a char count on the line of text. What am I missing?

If I have totally made myself unclear please let me know!

Could someone point me in the right direction please?

Dewayne

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by bluem1
0

Try this,

Dim feedXML As XDocument = XDocument.Load("c:\Feeds.xml")
        Dim bubba = From Feedmain In feedXML.Descendants("Feed") _
        Where (Feedmain.Attribute("status") Is Nothing) OrElse (Feedmain.Attribute("status").Value <> "disabled") _
        Select New With {.Name = Feedmain.Element("Name").Value()}

        DataGridView1.DataSource = bubba.ToList()
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.