Asp.Net 列表的问题 我想在网页中实现一个列表,它既能够分页,还能实现Excel的导入导出,这该怎么实现啊,有这样的列表控件吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 repeatergridviewstring strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=False;IMEX=1'"; using(OleDbConnection OleConn = new OleDbConnection(strConn)){ OleConn.Open(); String sql = "SELECT * FROM [Sheet1$]"; OleDbDataAdapter OleDaExcel = new OleDbDataAdapter(sql, OleConn); DataSet ds= new DataSet(); OleDaExcel.Fill(ds); OleConn.Close();} protected void Btn_ExportClick(object sender, EventArgs e){string style = @"<style> .text { mso-number-format:\@; } </script> "; Response.ClearContent();Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");Response.ContentType = "application/excel";StringWriter sw = new StringWriter();HtmlTextWriter htw = new HtmlTextWriter(sw);gv.RenderControl(htw);Response.Write(style); Response.Write(sw.ToString());Response.End();}public override void VerifyRenderingInServerForm(Control control){} 单独的倒是有,像netpagerexcel导入导出可以用程序控制 新手提问,老鸟帮忙回答下~ 这个问题搞半年了------关于button点击链接问题 各位大哥:如何在vbs调用shutdown.exe 如何在ASP.NET程序中访问局域网上共享的目录? 前两个参数我知道用来做什么的,但最后一个参数我不明白它用在哪?谁能给我讲讲? 多次提交问题 aso.net 中类的继承 哪儿有300/年左右的.net空间? 哥哥,救救小妹!关天datagrid repeater中如何实现点击按钮一次后永久禁止 动态绑定数据后的图片移动与静态写死图片移动的区别问题 list有办法不循环,直接得到某一个列吗?
gridview
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=False;IMEX=1'";
using(OleDbConnection OleConn = new OleDbConnection(strConn))
{
OleConn.Open();
String sql = "SELECT * FROM [Sheet1$]";
OleDbDataAdapter OleDaExcel = new OleDbDataAdapter(sql, OleConn);
DataSet ds= new DataSet();
OleDaExcel.Fill(ds);
OleConn.Close();
}
protected void Btn_ExportClick(object sender, EventArgs e){
string style = @"<style> .text { mso-number-format:\@; } </script> ";
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gv.RenderControl(htw);
Response.Write(style);
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
excel导入导出可以用程序控制