我有一个网格视图,其中显示文件名、内容类型……上传的 Efile。如何在gridview中的文件名旁边显示上传文件的图标。
<asp:GridView ID="GridViewEfile" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="Black"
DataKeyNames="FileID" GridLines="None" ShowHeader="False" >
<AlternatingRowStyle BackColor="Yellow" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" OnCommand="LinkButton1_Command" CommandName="Download" CommandArgument='<%#Eval("FileID")%>'><%#Eval("FileName")%></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ContentType" />
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Red" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
gridview 的数据源代码如下:
var queryefile = from efile in _DataContext.tblFiles
where ((efile.DocId == _DocId) && (efile.TransId == _TransmittalId))
select efile;
GridViewEfile.DataSource = queryefile;
GridViewEfile.DataBind();