更新时间:2023-10-05 09:23:16
更改此行 您的代码
< asp:ImageField HeaderText = 图像 ItemStyle-Width = 50px DataImageUrlField = ImagePath
ControlStyle-Width = 100 ControlStyle-Height = 100 />
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:
<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" />
change this line in your code <asp:ImageField HeaderText="Image" ItemStyle-Width="50px" DataImageUrlField="ImagePath" ControlStyle-Width="100" ControlStyle-Height = "100" />