c# - GridView and XMLDataSource -


i want display xml content @ aspx page. there aspx code:

    <asp:gridview id="gvxml" runat="server" autogeneratecolumns="true"         datasourceid="xmldata">     </asp:gridview>      <asp:xmldatasource runat="server" id="xmldata"         datafile="items.xml">     </asp:xmldatasource> 

and there xml content:

<?xml version="1.0" encoding="utf-8" ?> <inventories>     <vehicle name="lanos" year="1984" instock="no">         <rate>ok</rate>     </vehicle>     <vehicle name="jeep" year="2013" instock="yes">         <rate>dziadowstwo</rate>     </vehicle> </inventories> 

what wrong, suggestion.

this should assist you. appears missing xpath. can see further documentation here.

in short might such.

<asp:xmldatasource runat="server" id="xmldata"     datafile="items.xml"     xpath="//vehicle"> </asp:xmldatasource> 

edit: although know gridview nice pre-wired control may find more beneficial dig generic repeater , use item templates. in web forms days seemed there needed became overly messy gv. fyi u down road.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -