GridView中添加图片显示

实现功能:gridview中添加图片显示

ExpandedBlockStart.gif .aspx文件代码
< asp:SqlDataSource ID = " SqlDataSource1 "  runat = " server "  ConnectionString = " <%$ConnectionStrings:ConnectionString%> "
            SelectCommand
= "  select * from FriendsLink order by ID desc "  DeleteCommand = " delete from FriendsLink where ID=@ID "  UpdateCommand = " update FriendsLink set LinkName=@LinkName,LinkAdress=@LinkAdress,LinkPicPath=@LinkPicPath where ID=@ID " >
        
</ asp:SqlDataSource >
        
< asp:GridView ID = " GridView1 "  runat = " server "  AllowPaging = " True "  AllowSorting = " True "
            AutoGenerateColumns
= " False "  DataSourceID = " SqlDataSource1 "  ForeColor = " #333333 "
            BorderWidth
= " 1px "  RowStyle - HorizontalAlign = " Center "  CellPadding = " 3 "  GridLines = " Vertical "
            Width
= " 760px "  DataKeyNames = " ID "  PageSize = " 15 " >
            
< Columns >
                
< asp:HyperLinkField DataNavigateUrlFields = " ID "  DataNavigateUrlFormatString = " ./showLink.aspx?ID={0} "
                    DataTextField
= " LinkName "  HeaderText = " 详细信息 "   />
                    
                
< asp:ImageField DataImageUrlField = " LinkPicPath "  DataImageUrlFormatString = " {0} "  HeaderText = " Logo " >
                
</ asp:ImageField >
                
< asp:BoundField DataField = " LinkName "  HeaderText = " 链接名称 "  SortExpression = " LinkName "   />
                
< asp:BoundField DataField = " LinkAdress "  HeaderText = " 链接地址 "  SortExpression = " LinkAdress "   />
                
< asp:CommandField ShowEditButton = " true "  HeaderText = " 编辑 "   />
                
< asp:CommandField ShowDeleteButton = " True "  HeaderText = " 删除 "   />
            
</ Columns >
            
< RowStyle BackColor = " #EFF3FB "   />
            
< EditRowStyle BackColor = " #2461BF "   />
            
< SelectedRowStyle BackColor = " #D1DDF1 "  Font - Bold = " True "  ForeColor = " #333333 "   />
            
< PagerStyle BackColor = " #2461BF "  ForeColor = " White "  HorizontalAlign = " Center "   />
            
< FooterStyle BackColor = " #507CD1 "  Font - Bold = " True "  ForeColor = " White "   />
            
< HeaderStyle BackColor = " #507CD1 "  Font - Bold = " True "  ForeColor = " White "   />
            
< AlternatingRowStyle BackColor = " White "   />
        
</ asp:GridView >

 

aspx.cs文件中啥也不用写

效果如下: 

 

 

 

 不足之处:编辑时只能修改图片链接地址,而无法重新上传图片文件..可以考虑打开新的页面完成操作..不做赘述了就

 

 

外加一个参考链接吧:http://hi.baidu.com/yanghuhu/blog/item/22c471ee9b75851afdfa3c1a.html 

 

 

 

 

 

转载于:https://www.cnblogs.com/xfiver/archive/2010/05/08/1730800.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值