日期:2014-05-17  浏览次数:20520 次

asp.net gridview导出excel
asp.net gridview导出excel用户可以自己选择路径 ,重命名,,求方法,求代码
SOS
------解决方案--------------------
http://www.51aspx.com/Code/DtocsvRtoDataset
看看这个 源码
------解决方案--------------------
你随便从百度输入 GRidView 导出 Excel,资料N多,还都带解释的
------解决方案--------------------
http://www.cnblogs.com/stswordman/archive/2006/08/24/485641.html
------解决方案--------------------
引用
你随便从百度输入 GRidView 导出 Excel,资料N多,还都带解释的 




------解决方案--------------------

<%@ Page Language="C#" AutoEventWireup="true"  EnableEventValidation = "false" CodeFile="DropDownLIst.aspx.cs" Inherits="_20100608_Default" %>

<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="grd" runat="server" BackColor="White" BorderColor="#E7E7FF" 
BorderStyle="None" BorderWidth="1px" CellPadding="3" 
GridLines="Horizontal" AutoGenerateColumns="False">
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C"  />
<Columns>


<asp:BoundField DataField="ID" />
<asp:BoundField DataField="Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList  runat="server" ID="ddl" Width="50px"  AutoPostBack="true">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem Selected="True">2</asp:ListItem>
</asp:DropDownList></ItemTemplate>
</asp:TemplateField >
<asp:TemplateField HeaderText="123">
<ItemTemplate>
<asp:TextBox ID="txt" runat="server" ></asp:TextBox></ItemTemplate>
</asp:TemplateField>

</Columns>
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
<asp:Button ID="btnDataToExcel" runat="server" Text="导入Excel" Width="166px" 
onclick="btnDataToExcel_Click"  />
<webdiyer:AspNetPager ID="PagerNet" runat="server"  PageSize="5" 
onpagechanged="PagerNet_PageChanged">
</webdiyer:AspNetPager>
</div>
</form>
</body>
</html>
、、后台代码
public partial class _20100608_Default : System.Web.UI.Page
{
DataSet ds=DBAccess.ExecuteDataset("Select row_number() over(order by Id) as num, * from person");