| 发表于:2007-01-22 15:26:086楼 得分:0 |
那你举的例子来说 <asp:gridview id= "gvmegbrowse " > <asp:templatefield headertext= "姓名 "> <itemtemplate> <asp:hyperlink id= "hylimg " runat= "server "> </asp:hyperlink> <asp:label id= "hylname " runat= "server " text= ' <%# databinder.eval(container, "dataitem.name ") %> '> (改成你自己要帮定的段) </asp:label> </itemtemplate> </asp:templatefield> </asp:gridview> 在 .cs文件中的rowdatabound事件中写 protected void gvmegbrowse_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowindex > = 0) { (cell[i]中i为你要显示图片的列) hyperlink hylimg = (hyperlink)e.row.cells[0].findcontrol( "hylimg "); hylimg.imageurl = "../../images/status_0.gif ";(图片地址) } } | | |
|