I have an image column in a database table, and I want to show this image in a GridView column, how can I implement that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Similar to what @JaneDoe suggest, you’ll need to specify the ImageUrl, however when you bind, you’ll need to set the ImageUrl property to point to an HttpHandler with the primary key as a query string parameter.
e.g.
<asp:Image runat="server" ImageUrl="/myImageHandler.axd?pk=<%# Eval("PrimaryKey") %>"/>You’ll then need to configure your HttpHandler to send a response of image/jpeg or whatever image type you’re storing and then read the varbinary data from the DB based on the PK passed in, in the query string and output that data to the response stream.