Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi all,
Please tell me the expression tag to bind image control with image type data of sql server table.

(e.g. expression tag to bind textbox with text data of sql table is '<%#Eval("Img_Id") %>'. It is done in the following way
<asp:TextBox ID="TextBox1" Text='<%#Eval("Img_Id") %>' runat="server">
Similarly please tell me expression tag for image control
<asp:Image ID="Image1" runat="server" />
)
Posted

1 solution

There is no such expression tag. :( there are following choices:

1. Write a http handler which takes the id and renders image content, assign the url to src tag like src ='imagehandler.ashx<%#Eval("ImageId")%>' something like this, you can get exact syntax by googling.

2. Use third party controls like telerik provides one RadBinaryImage which does all this for you.

I would suggest option 1 is not that difficult.

-Rohit
 
Share this answer
 
Comments
Skand Pratap Singh 8-Dec-12 0:04am    
thank you very much for your answer, but actually i am very new in the field so implementing the handler is quite a task for me... any way thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900