Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In my website, I used Gridview to show images but it shows the full size of image. But I need to control the size of image. Plese suggest me.

this is my gridview:
XML
<asp:GridView ID="GridView1" runat="server"
              AutoGenerateColumns="False"
              DataSourceID="SqlDataSource1" AllowPaging="True"
            EnableSortingAndPagingCallbacks="True" ForeColor="#333333" CellPadding="4"
            GridLines="None" PageSize="3">
    <AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
<asp:BoundField DataField="ImageName" HeaderText="Image Name"
        SortExpression="ImageName" />
    <asp:ImageField HeaderText="Image"   ItemStyle-Width="50px" DataImageUrlField="ImagePath" />
Posted

1 solution

C#
change this line in your code 
<asp:ImageField HeaderText="Image"   ItemStyle-Width="50px" DataImageUrlField="ImagePath"  
ControlStyle-Width="100" ControlStyle-Height = "100"  />
 
Share this answer
 
Comments
Nuruzzaman Bepari 9-Jul-13 10:07am    
tnanks bro..

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