Hello,
I'm trying to fill a GridView with some dynamic XmlDocument, and for now, it works pretty well.
Here is what I have :
//This array of XmlDocument is the result of a search on a database with some proprietary classes
XmlDocument[] TableauNotices = simImport.XMLDOMDocumentArray(IdentifiantsNotices, false, true, 0, "", true, true, true);
GridViewCible.DataSource = TableauNotices;
GridViewCible.DataBind();
<asp:TemplateField ItemStyle-CssClass="CelluleResultat">
<ItemTemplate>
<%# "Titre : <em><strong>" + XPath("INTERPRETATION_OEUVRE/DESCRIPTION/OEUVRE_LIBRE/TITRE") + "</strong></em><br />"%>
<%# "Auteur : <em>" + XPath("INTERPRETATION_OEUVRE/DESCRIPTION/OEUVRE_LIBRE/AUTEUR") + "</em><br />"%>
</ItemTemplate>
</asp:TemplateField>
Now what I would like to do is check whether a node of my XmlDocument is empty, so it won't show "Titre : " and nothing after it but just jump this line. This code sample doesn't work :
<%# (XPath("INTERPRETATION_OEUVRE/DESCRIPTION/OEUVRE_LIBRE/TITRE") == "") ? "" : "Titre : <em><strong>" + XPath("INTERPRETATION_OEUVRE/DESCRIPTION/OEUVRE_LIBRE/TITRE") + "</strong></em><br />"; %>
AND, I would like to be able to display as many lines as there are nodes in a node list. Something like :
<%# foreach (XPath("INTERPRETATION_OEUVRE/DESCRIPTION/OEUVRE_LIBRE/DIFFERENT_TITLE") "Different title : <em><strong>" + XPath("INTERPRETATION_OEUVRE/DESCRIPTION/OEUVRE_LIBRE/DIFFERENT_TITLE") + "</strong></em><br />"; %>
How can I do all of this without destroying too much what I already achieved?
Thank you for your help.