<div>
<asp:DataList ID="DataList1" runat="server">
            <ItemTemplate>
                <table>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("BookID") %>'></asp:Label></td>
                        <td style="width: 100px">
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("BookUrl") %>' /></td>
                    </tr>
                </table>
            </ItemTemplate>
</asp:DataList></div>如上,如何修改才能达到效果,"BookID"为图片编号,"BookUrl"为图片路径。用Javascript也可以。那位高手有时间帮帮忙。我将不胜感激!!!我暂时没分,待结果出来后我一定补过100分,说到做到!
效果图:http://search.eachnet.com/search/--146001--productlist-basicsearch.html?_fromid=homepage_3006_02_0802_0101&srcid=a294_16

解决方案 »

  1.   

                        
    Image1.Attributes.Add("onmouseover","this.width=300;this.height=300;");
                        
    Image1.Attributes.Add("onmouseout", "this.width=100;this.height=100;");
    把这个加入到 Image1的数据绑定事件里去  就是给 image1 添加两个 事件 这样写,其实 生成的是js ... 不用这方法。 直接写js 也是一样这是简单的写法..  关键看你怎么用了   如果你想实现 你给的地址的那种效果 就这个就足够了 把尺寸修改成你需要的尺寸就是了复杂一些的话 你加些逻辑 进去 比如获取原始尺寸  放大的时候按比例放大 等等 ..
      

  2.   


              public static int[] GetBigImage(float x, float y,int z)
            {
                int[] x_y = new int[2];            x_y[0] = (int)z;
                x_y[1] = (int) (y * (z / x));            return x_y;
               
            }
    调用此方法得到 等比放大 宽度和高度    参数x 是 图片原始宽度
    参数y 是 图片原始高度
    参数 z 是 宽度参考  即放大后图片的宽度 通过这个 得到放大后 图片的高度返回一个 数组.  剩下的怎么用 不用解释了吧?当然。 这个方法我临时写的.比例并不非常精确 。够用就是了
      

  3.   

    是在这里写吗?
        我试了好久搞不出来,那位仁兄指点一下:
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item ||
                 e.Item.ItemType == ListItemType.AlternatingItem)
            {
                这里怎么帮定控件?
            }
        }