Avatar of framos1
framos1

asked on 

How do I populate a Gridview control from In memory LINQ query results of an XML response?

I am trying to figure out if I am even using the right control. (Gridview)

The Linq Query works fine, but I cannot get the Gridview1 control to populate or even show.  It doesn't even error out when debugging. I can step right through the code as if everything is perfect but no data results on the web page.

I have tried it by passing the results from a Dim'd query and also directly as shown in the snippet below. Both ways  bind as far as I can tell.
Any help would be appreciated.

-F
******** Direct Version******
GridView1.DataSource = _
        From manuf In partlist.Descendants("product") _
        Select ManName = _
        manuf.Element("manufacturer").Value, _
        Desc = manuf.Element("descriptionLine1").Value, _
        MfgPart = manuf.Element("partNumber").Value, _
        qty = manuf.Element("quantity").Value, _
        cost = manuf.Element("cost").Value, _
        LineNum = manuf.@lineItemNumber, _
        Note = manuf.Element("note").Value, _
        price = manuf.Element("price").Value()
 
        GridView1.DataBind()
 
******Other Method****
        Dim PartlistQRY = _
        From manuf In partlist.Descendants("product") _
        Select ManName = _
        manuf.Element("manufacturer").Value, _
        Desc = manuf.Element("descriptionLine1").Value, _
        MfgPart = manuf.Element("partNumber").Value, _
        qty = manuf.Element("quantity").Value, _
        cost = manuf.Element("cost").Value, _
        LineNum = manuf.@lineItemNumber, _
        Note = manuf.Element("note").Value, _
        price = manuf.Element("price").Value()
 
        GridView1.DataSource = PartlistQRY 
        GridView1.DataBind()

Open in new window

.NET ProgrammingVisual Basic.NETASP.NET

Avatar of undefined
Last Comment
Fernando Soto

8/22/2022 - Mon