Telerik的radgrid控件导出文件名 [英] Telerik Radgrid export file name

查看:479
本文介绍了Telerik的radgrid控件导出文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个是否知道如何提供文件名来导出的文件中的 Telerik的radgrid控件
导出的文件可以是任何格式的PDF,Excel或Word

Does any one know how to provide file name to the exported file in Telerik RadGrid, Exported file could be of any format pdf, excel or word

推荐答案

来源:<一个href=\"http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx\">Grid / MS的Excel /微软Word / CSV

使用RadGrid.ExportSettings.FileName属性,一个字符串指定
  命名将要创建的文件(不带扩展名)。该
  文件扩展名被自动添加根据所使用的方法
  尝试如下图所示设置文件名 ItemCommand 事件。

Use RadGrid.ExportSettings.FileName property, a string specifying the name (without the extension) of the file that will be created. The file extension is automatically added based on the method that is used Try setting the FileName in the ItemCommand event as shown below.

从:<一href=\"http://www.telerik.com/community/forums/aspnet-ajax/grid/when-to-set-radgrid-exportsettings-filename.aspx\">When设置RadGrid.ExportSettings.FileName

protected void Radgrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.ExportToPdfCommandName)
    {
        Radgrid1.ExportSettings.FileName = "yourfilename";
    }
    if (e.CommandName == RadGrid.ExportToExcelCommandName)
    {
        Radgrid1.ExportSettings.FileName = "yourfilename";
    }
    if (e.CommandName == RadGrid.ExportToWordCommandName)
    {
        Radgrid1.ExportSettings.FileName = "yourfilename";
    }
}

参考:结果
<一href=\"http://www.telerik.com/community/$c$c-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx\">Export radgrid控件的内容到Excel /字/ CSV /阿贾克斯PDF启用

这篇关于Telerik的radgrid控件导出文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆