Jump to content
Sign in to follow this  
jokismoki

how to read xml nodes with same name in c# gridview?

Recommended Posts

how to read xml nodes with same name in c#?

I have XML file with a users, and their personal informations(name, surname, age, photos...).

I'm displaying this infos in gridview, and everything is ok. Just cannot select one photo to display in the gridview, one photo for every user, like profile photo. I cannot do this cause there is not a tag .

There are more tags with same name like in example below. So i'm trying to select all infos, put in datatable, and display in gridview control with Eval("Foto") functioon.

But photos cannot be displayd because in evel function cannot be inserted more photos in same time.

This is the structure of the photos in the XML document:

<User><Name>User name</Name><Surname>User surname</Surname><Foto>http://website.com/images/image1.jpg</Foto><Foto>http://website.com/images/image2.jpg</Foto><Foto>http://website.com/images/image3.jpg</Foto><Foto>http://website.com/images/image4.jpg</Foto></User>

This is the gridview control which i use

<asp:GridView ID="GridView1" ShowFooter="false" ShowHeader="false" CssClass="tablepress-id-N" runat="server" AutoGenerateColumns="false" AllowPaging="true" OnPageIndexChanging="OnPageIndexChanging" onrowdatabound="GridView1_RowDataBound"><Columns><asp:TemplateField><ItemTemplate><li class="objectListItem"><div style="float:left;width:12%;margin-right:5%;"><asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Foto")%>'></asp:Image></div></ItemTemplate></asp:TemplateField></Columns><pagerstyle cssclass="gridviewPager"></pagerstyle></asp:GridView>

Where i make a mistake?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...