asp.net导出到excel
导出到excel的方法有多种,比较常见的是直接导出到EXCEL,还有就是先将页面的数据写到磁盘文件,之后直接再打开文件,另外还有就
是借助第三方的控件。
前段时间写的导出数据到excel在excel2003中正常而在excel2007中数据乱码,今天了解到原来是Response.ContentType = "application/ms-excel";导致的,改为Response.ContentType = "application/vnd.ms-excel";正常
public partial class Manager_ExportOrder : ShopOrderBase
{
#region 事件
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnSubmit.Visible = true;
this.btnDelete.Visible = false;
BindGridView();
//显示提示信息
IList<WfmSysDictionaryItems> lst = GetChildOfFunPurview(Resources.Resource.safeMange);
if (lst != null || lst.Count > 0)
{
if (lst.Count == 1 && lst[0].SiName.Contains("一个月"))
{
lblShow.Text = "以下数据是上个月之前的所有订单";
}
相关文档:
本文将探讨asp.net下实现文件上穿进度条的方法。
一般情况下,要实现上传进度条首先要实现上传文件分块读取,而默认情况下,iis将直接把上传的文件一次读入到内存中,所以本处的难点在于拦截iis的文件上传过程,转而自己的实现方式。所以,我们可以实现一个IHttpModule来处理上传过程。具体的过程是Application_BeginReque ......
@Register : Register a user control or class with alias to this page.
@Import: Import a namespace.
@Reference: Link user controls or other page to complile current page. 支持数据跨页面的传送
页面事件:PreInit(创建服务器控件), Init(初始化服务器控件的状态), InitComplete,PreLoad, Load, Lo ......
今天在用DataList的模板列的时候习惯性地像在03中那样去给模板列的绑定字段加个处理函数:
< asp:Label ID = " Label1 " runat = " server " Text = ' <%#ConvertState(Bind("Status"))%> ' ></ asp:Label >
可是竟然出错:当前上下文中不存在名称“Bind” ......
异常详细:
1. 错误列表没有记录,编译通过。
2. 显示输出:
“WebDev.WebServer.EXE”(托管): 已加载“C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll”,已跳过符号加载。已对模块进行了优化并启用了调试器选项“仅我的代码”。
“WebDev.WebServer ......
在ASP.NET 1.1中,要做1个弹出的确认对话框的话,一般是在服务端的代码中这样写:
private void Page_Load(object sender, System.EventArgs e)
{
btnClick.Attributes.Add("onclick", "return confirm('Are you sure?');");
// Button1.Attributes["OnClick"] = "return conf ......