S
Showjumper
Hi i posted this on the dotnet xml group but that group does not get much
traffic so i thought to post here.
I have a photo gallery that works by looping thru the images, making an xml
file and then binding it to the datalist. The gallery part works fine. My
next task was to make an admin page so that captions for each of the photos
could be edited. In the edititemtemplate i have a textbox for the caption
edit and 2 linkbuttons. Using the following syntax i can locate a specific
node and edit the caption. My main problem is that it only works when the ID
is hardcoded. Only issue i have right now is how to pass in the ID
dynamically based on which image is clicked. The xml structure is below as
well. The other alternative xml structure i used was to have the ID its own
element as <PhotoID>1 </PhotoID> as an example. In this case i could set the
DataKeyField to PhotoID but i was not able to edit the Caption node using
this structure - i had issue with the xpath syntax.. I was able to edit the
caption if the ID was an attribute of the Photo element. Just need some help
in making htis work. Thanks in advance Ashok
Dim nodeList As XmlNodeList =
xmlDoc.SelectNodes(String.Format("/Photos/Photo[@ID='{0}']", ID))
nodeList(0).ChildNodes(0).InnerText = Caption
xmlDoc.Save(filepath)
<Photos>
<Photo ID="1">
<Caption>FGHFGHDFG</Caption>
<FileName>DSC00067.jpg</FileName>
<FilePath>~/photos/Stills/DSC00067.jpg</FilePath>
<ThumbnailFilePath>~/photos/Stills/thumbnails/DSC00067.jpg</ThumbnailFilePath>
</Photo>
<Photo ID="2">
<Caption>FGHFGHDFG</Caption>
<FileName>DSC00068.jpg</FileName>
<FilePath>~/photos/Stills/DSC00068.jpg</FilePath>
<ThumbnailFilePath>~/photos/Stills/thumbnails/DSC00068.jpg</ThumbnailFilePath>
</Photo>
</Photos>
traffic so i thought to post here.
I have a photo gallery that works by looping thru the images, making an xml
file and then binding it to the datalist. The gallery part works fine. My
next task was to make an admin page so that captions for each of the photos
could be edited. In the edititemtemplate i have a textbox for the caption
edit and 2 linkbuttons. Using the following syntax i can locate a specific
node and edit the caption. My main problem is that it only works when the ID
is hardcoded. Only issue i have right now is how to pass in the ID
dynamically based on which image is clicked. The xml structure is below as
well. The other alternative xml structure i used was to have the ID its own
element as <PhotoID>1 </PhotoID> as an example. In this case i could set the
DataKeyField to PhotoID but i was not able to edit the Caption node using
this structure - i had issue with the xpath syntax.. I was able to edit the
caption if the ID was an attribute of the Photo element. Just need some help
in making htis work. Thanks in advance Ashok
Dim nodeList As XmlNodeList =
xmlDoc.SelectNodes(String.Format("/Photos/Photo[@ID='{0}']", ID))
nodeList(0).ChildNodes(0).InnerText = Caption
xmlDoc.Save(filepath)
<Photos>
<Photo ID="1">
<Caption>FGHFGHDFG</Caption>
<FileName>DSC00067.jpg</FileName>
<FilePath>~/photos/Stills/DSC00067.jpg</FilePath>
<ThumbnailFilePath>~/photos/Stills/thumbnails/DSC00067.jpg</ThumbnailFilePath>
</Photo>
<Photo ID="2">
<Caption>FGHFGHDFG</Caption>
<FileName>DSC00068.jpg</FileName>
<FilePath>~/photos/Stills/DSC00068.jpg</FilePath>
<ThumbnailFilePath>~/photos/Stills/thumbnails/DSC00068.jpg</ThumbnailFilePath>
</Photo>
</Photos>