GridView有一个数据绑定,然后要显示图片的问题。
简单代码如下:
我的sSmallImg即{0}是要用一个函数处理后才会成为一个真正的图片地址。请问我在哪儿加这个函数?
函数名为:reChangeImgUrl(sUrl)
=================================
<asp:GridView ID= "GridView1 " runat= "server " AllowPaging= "True " AutoGenerateColumns= "False "
DataKeyNames= "sID " DataSourceID= "SqlDataSource1 " BackColor= "White " BorderColor= "#CC9966 " BorderStyle= "None " BorderWidth= "1px " CellPadding= "4 ">
<Columns>
<asp:ImageField DataImageUrlField= "sSmallImg " DataImageUrlFormatString= "UpLoad/{0} ">
</asp:ImageField>
</Columns>
</asp:GridView>
------解决方案--------------------用模板列
<%#reChangeImgUrl(Eval( "sSmallImg ").ToString())%>
函数在后台写
protected string reChangeImgUrl(...