I have a grid view with an asp image control and I'm having a problem setting the width from the database. I have an sql server table that stores the image url and and the image width in a bigInt field. When I try to bind the width of the image control to the field in the table I get an error Specified cast is not valid.
Can someone help me out with this?
This is my sql
Code:
SELECT TOP (100) PERCENT BlogId, Title, Body,
BlogDate, Deleted, '~/Images/' + ISNULL(ImageUrl, N'Blank.png') AS ImageUrl,
ISNULL(Width, 1) AS Width
FROM dbo.Blogs
WHERE (Deleted = 0) OR (Deleted IS NULL)
This is the html for my image control in the item template
HTML Code:
<asp:Image ID="Image1" runat="server" CssClass="BlogGridImageRight"
ImageUrl='<%# Eval("ImageUrl") %>' Width='<%# Eval("Width") %>' />
I'm using visual studio 2010