【发布时间】:2016-05-03 08:00:25
【问题描述】:
我有以下网格视图,我想将列添加为图像图标以将所选行提取到 Excel 工作表。图片 onclick 事件背后的代码是什么。
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="SuppliersPage.aspx.cs" Inherits="WebApp_UNICEF.SuppliersPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:GridView ID="grdMain" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None"
AutoGenerateSelectButton="True"
onselectedindexchanged="grdMain_SelectedIndexChanged"
BorderColor="#1EA4DA" BorderStyle="Solid" BorderWidth="1px"
CellSpacing="2" onrowdatabound="grdMain_RowDataBound" AllowPaging="True"
AllowSorting="True" onpageindexchanging="grdMain_PageIndexChanging"
onrowcreated="grdMain_RowCreated"
>
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" BorderColor="#19A5D9" BorderStyle="Solid"
BorderWidth="1px" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" BorderStyle="Solid"
BorderWidth="1px" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
【问题讨论】:
-
我认为你必须这样做:- stackoverflow.com/questions/7961269/…