Click here to Skip to main content
16,017,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

How to control the display size (length and width) image is defined as a field in GRIDVIEW.

I added new field in "GRIDVIEW" , type "image field" .
I fill the "dataImageUrlField" field with IMAGE path in dynamic process .
the problem is , in the lines of GRIDVIEW display getting very large display of image .
how I can control on image display (much more small)


Best Regards & Thanks
Eli
Posted

1 solution

XML
<asp:TemplateField>
<ItemTemplate>
<img src='<%# string.Format("data:image/gif;base64,{0}",Convert.ToBase64String((byte[])Eval("Images")))%>' width="125px" height="120px" />
 </ItemTemplate>
 </asp:TemplateField>



add like this....
 
Share this answer
 
Comments
eli gerby 20-May-13 5:24am    
getting the following error:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Images'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Images'.

Source Error:


Line 14: <asp:TemplateField>
Line 15: <itemtemplate>
Line 16: <img src='<%# string.Format("data:image/gif;base64,{0}",Convert.ToBase64String((byte[])Eval("Images")))%>' width="125px" height="120px" />
Line 17:
Line 18:
Charan_Kumar 20-May-13 5:53am    
Images name is the name of the column name in database table

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