This is a migrated thread and some comments may be shown as answers.

[Solved] RadGrid export problem

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
gilad
Top achievements
Rank 1
gilad asked on 29 Apr 2013, 01:17 PM
I tried exporting a radgrid after filtering, and it export all data, and not filtered data.
It shouldn't work this way, I need to export only data according to filters.

The export method:
 public void ExportToExcel()
        {
            string sCurentData = DateTime.Today.ToShortDateString();
            string filename = "Users_Report_" + sCurentData;

            UsersGrd.ExportSettings.IgnorePaging = true;
            UsersGrd.ExportSettings.ExportOnlyData = true;
            UsersGrd.ExportSettings.OpenInNewWindow = true;

            UsersGrd.MasterTableView.ShowFooter = false;

                UsersGrd.MasterTableView.Columns[8].Visible = false;
                UsersGrd.MasterTableView.Columns[9].Visible = false;
                UsersGrd.MasterTableView.Columns[10].Visible = false;

            UsersGrd.MasterTableView.AllowFilteringByColumn = false;
                UsersGrd.ExportSettings.FileName = filename;
            UsersGrd.MasterTableView.ExportToExcel();
        }

Ascx:
<telerik:RadGrid ID="UsersGrd" AutoGenerateColumns="False" runat="server" PagerStyle-AlwaysVisible="true" PageSize="10" OnNeedDataSource="UsersGrd_NeedDataSource" 
    Skin="Default" ShowStatusBar="True" ShowFooter="True" AllowPaging="True" CellSpacing="0" FooterStyle-CssClass="custom-footer" PagerStyle-CssClass="custom-footer"
    GridLines="Horizontal" Width="1265px" AllowSorting="true"  Style="margin-top:10px; border: 0px;margin-bottom:20px;" OnItemCommand="SubmitCommand" OnItemDataBound="grdUsers_ItemDataBound">


Need data source:
protected void UsersGrd_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
[....]
UsersGrd.DataSource = data;
}

What is the problem? Why is not working as it should?
Thanks.

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 01 May 2013, 03:08 PM
Hello Gilad,

I was not able to reproduce the issue. I prepared a small sample and attached it to this forum post. Could you please give it a try and let me know how it differs from your real setup? Additionally sending us your code declaration and the related code behind could help us to pinpoint the reason for that behavior.

All the best,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
gilad
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or