Gridview导出到Excel

news/2024/7/21 5:46:17 标签: 导出, Excel
#region #导出Excel
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.ClearContent();
        Response.AddHeader("content-disposition", "attachment;filename=MyExcelFile.xls");
        Response.ContentType = "application/excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        GridView1.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }
    #endregion
    public override void VerifyRenderingInServerForm(Control control)
    {
    }

http://www.niftyadmin.cn/n/925488.html

相关文章

ElasticSearch Snowball token filter

Snowball token filter 使用除梗器,对单词进行除梗的过滤器。语言参数可以控制除梗器,有如下的语言可供选择: Armenian, Basque, Catalan, Danish, Dutch, English, Finnish, French, German, German2, Hungarian, Italian, Kp, Lithuanian, Lovins, Norwegian, Porter, Por…

Elastic search N-gram tokenizer

文章目录 N-gram tokenizer配置N-gram tokenizer ngram 分词器,首先将text文本切分,执行时采用N-gram切割算法。 N-grams 算法,就像一个穿越单词的滑窗,是一个特定长度的持续的字符序列。这个适合于那些不太使用空格符的语言,或者有长的复合单词的语言,比如德语。 举个…

ElasticSearch概述(介绍,用途,应用场景,优缺点)

ElasticSearch 介绍 ElasticSearch 是一个基于lucene的搜索服务,它提供了一个分布式多用户能力的全文搜索引擎,基于restful web接口。 ElasticSearch 是用Java开发的(所以,如果你要是用,机器需要安装java环境),并作为Apache许可条款下的开放源码发布,是当前流行的企业…

ElasticSearch之增删改查操作

一、基本操作 1.1 创建索引 格式:PUT /索引名称 举例:PUT /db_index 1.2 查询索引 格式:GET/ 索引名称 举例:GET/db_index 1.3 删除索引 格式:DELETE/ 索引名称 举例:DELETE/db_index 可以看到上图中,删除后 1.4 添加文档 格式:PUT /索引名称/类型/id/json内…

.net 动态创建sql数据库表

//必须的命名空间using System;using System.Data;using System.Data.SqlClient;//中间常规内容略string tabName "table1";//声明要创建的表名,你也可以改为从textbox中获取;string sqlStr "create table ";sqlStr tabName &qu…

ElasticSearch文档映射

mapping 概述 ElasticSearch的核心概念和关系型数据库对比,索引(index)相当于数据库,类型(type)相当于数据表,映射(mapping)相当于数据表的结构。 映射可以分为动态映射和静态映射 (1)动态映射 我们知道,在关系型数据库中,需要事先创建数据库,然后在该数据库…

java.io.IOException: com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 110

报错 rpc消费者报如下错误 at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.handleValue(DecodeableRpcResult.java:134)at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(DecodeableRpcResult.java:92)at org.apache.dubbo.rpc.protocol.dub…

io.protostuff.runtime.RuntimeUnsafeFieldFactory cannot have the same number

报错 消费方调用rpc pb序列化报错如下: ExecutionException: java.lang.RuntimeException: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: io.protostuff.runtime.Runti meUnsafeFieldFactory$9$1254189a5 and io.protostuff.runti…