CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: gridview and xmldatasource bug

  1. #1
    Join Date
    Jul 2002
    Posts
    137

    gridview and xmldatasource bug

    hi

    I get the following error when I create a gridview and link it to a simple xmldatasource:

    there was an error rendering the control.
    The data source for GridView with id 'GridView1' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.

    then when i run the form, i get an exception:
    The data source for GridView with id 'GridView1' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.

    xml:
    <?xml version="1.0" encoding="utf-8"?>
    <messages>
    <message>
    <name>Ping Nifty Tools</name>
    <text>**** Item started ****</text>
    <timeStamp>10-15-2006 18:13:02</timeStamp>
    <type>5</type>
    <typeText>n/a</typeText>
    <status>Unknown</status>
    </message>
    </messages>

    -----------------
    <asp:XmlDataSource ID="OpMsgXmlDataSource" runat="server" DataFile="~/App_Data/OP_MSGS.XML">
    </asp:XmlDataSource>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="OpMsgXmlDataSource">
    </asp:GridView>


    any ideas?

  2. #2

    Re: gridview and xmldatasource bug

    It looks like the XmlDataSource will use attributes for Column / Header names in a GridView, where elements are used for TreeNav controls.

    To fix your issue, just change the xml file to:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <messages>
      <message
        name="Ping Nifty Tools"
        text="**** Item started ****"
        timeStamp="10-15-2006 18:13:02"
        type="5"
        typeText="n/a"
        status="Unknown"
      />
    </messages>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)