Welcome Guest Search | Active Topics | Sign In | Register

Using Grid with XmlDataSource Options
eo_support
Posted: Saturday, February 19, 2011 8:04:02 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
The following sample code demonstrates how to use EO.Web Grid with XmlDataSource:

XML file:
Code: XML

<books>
    <book Name="Book1" Author="John">
    </book>
    <book Name="Book2" Author="Mark">
    </book>
</books>


XmlDataSource:
Code: HTML/ASPX
<asp:XmlDataSource ID="XmlDataSource1" 
    runat="server" DataFile="~/XMLFile1.xml">


Grid:
Code: HTML/ASPX
<eo:Grid ......>
    ....
    <Columns>
        <eo:RowNumberColumn>
        </eo:RowNumberColumn>
        <eo:StaticColumn DataField="Name" HeaderText="Header">
        </eo:StaticColumn>
        <eo:StaticColumn DataField="Author" HeaderText="Header">
        </eo:StaticColumn>
    </Columns>
    ....
</eo:Grid>


The key to use EO.Web Grid with an XmlDataSource are:

1. The Grid does not automatically create columns. Columns must be explicitly created (either statically in your .apsx file or dynamically through code). The above sample statically declared three columns;
2. A column's DataField must be set to the xml node's attribute name in order to load data from that attribute. The above sample has DataField set to "Name" and "Author" so that it can load book element's Name and Author attribute;
3. The Grid supports in place editing (you will need to use other column types such as TextBoxColumn) however it does not automatically save changes back to your data source. Please refer to the documentation on how to save changes back to your data source;

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.