I'm trying to databind the width of an image from a Xml file to a asp:Image control.
Here's the xml markup for the image:
<image>
<url>~/Images/test.jpg</ur
l>
<width>130</width>
<height>90</height>
</image>
Here's the <asp:Image> control:
<asp:Image ID="Image1" runat="server"
ImageUrl='<%# XPath("image/url") %>'
Width='<%# XPath("image/width") %>' />
I'm sure the XmlDataSource is setup correctly because other fields are databinding properly.
And if I take the "Witdth" attribute out of the Image control, everything works.
The error message I get, on the <asp:image> control, is: Specified cast is invalid
Can anyone help with this?
I need to be able to specify the width and height from the xml file.
Thanks!
Start Free Trial