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

Export to Excel - exports dataset as well as grid

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff Reinhardt
Top achievements
Rank 1
Jeff Reinhardt asked on 26 Mar 2010, 03:35 PM
DataSet dsAdminEventInvites = new DataSet();  
EventInvite.GetEventInvites(databaseName, eventID, ref dsAdminEventInvites, ref errorMsg);  
rgInvitesExport.DataSource = dsAdminEventInvites;  
rgInvitesExport.DataBind();  
 
rgInvitesExport.ExportSettings.OpenInNewWindow = true;  
rgInvitesExport.ExportSettings.ExportOnlyData = true;  
rgInvitesExport.ExportSettings.IgnorePaging = true;  
rgInvitesExport.ExportSettings.FileName = "EventAttendees_Report";  
 
rgInvitesExport.MasterTableView.ExportToExcel(); 

That is my export code....   here is the grid:

<telerik:RadGrid ID="rgInvitesExport" runat="server" > 
            <MasterTableView> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="EventID" HeaderText="Event ID" UniqueName="EventID" /> 
                    <telerik:GridBoundColumn DataField="InviteID" HeaderText="Invite ID" UniqueName="InviteID" /> 
                    <telerik:GridBoundColumn DataField="ProfessionalID" HeaderText="Professional ID" UniqueName="ProfessionalID" /> 
                    <telerik:GridBoundColumn DataField="Title" HeaderText="Title" UniqueName="Title" /> 
                    <telerik:GridBoundColumn DataField="Affiliation" HeaderText="Affiliation" UniqueName="Affiliation" /> 
                    <telerik:GridBoundColumn DataField="Degrees" HeaderText="Degrees" UniqueName="Degrees" /> 
                    <telerik:GridBoundColumn DataField="Specialty" HeaderText="Specialty" UniqueName="Specialty" /> 
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="FirstName" /> 
                    <telerik:GridBoundColumn DataField="MiddleName" HeaderText="Middle Name" UniqueName="MiddleName" /> 
                    <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="LastName" /> 
                    <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" /> 
                    <telerik:GridBoundColumn DataField="State" HeaderText="State" UniqueName="State" /> 
                    <telerik:GridBoundColumn DataField="Province" HeaderText="Province" UniqueName="Province" /> 
                    <telerik:GridBoundColumn DataField="PostalCode" HeaderText="Zip" UniqueName="Zip" /> 
                    <telerik:GridBoundColumn DataField="OfficePhone" HeaderText="OfficePhone" UniqueName="OfficePhone" /> 
                    <telerik:GridBoundColumn DataField="OfficePhoneExt" HeaderText="OfficePhoneExt" UniqueName="OfficePhoneExt" /> 
                    <telerik:GridBoundColumn DataField="CellPhone" HeaderText="CellPhone" UniqueName="CellPhone" /> 
                    <telerik:GridBoundColumn DataField="Fax" HeaderText="Fax" UniqueName="Fax" /> 
                    <telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email" /> 
                    <telerik:GridBoundColumn DataField="DietaryNeed" HeaderText="Dietary Need" UniqueName="DietaryNeed" /> 
                    <telerik:GridBoundColumn DataField="DietaryNeedOther" HeaderText="Dietary Need Other" UniqueName="DietaryNeedOther" /> 
                    <telerik:GridBoundColumn DataField="BestContact" HeaderText="Best Contact" UniqueName="BestContact" /> 
                    <telerik:GridBoundColumn DataField="BestContactOther" HeaderText="Best Contact Other" UniqueName="BestContactOther" /> 
                    <telerik:GridBoundColumn DataField="ResponseDateTime" HeaderText="Registered Date and Time" UniqueName="ResponseDateTime" /> 
                    <telerik:GridBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status" /> 
                </Columns>                          
            </MasterTableView> 
        </telerik:RadGrid> 

When I export the grid that full dataset is attached after the grid data as extra columns!!!  Help!

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 Mar 2010, 06:53 PM
Hello Jeff,

Please try to disable the AutoGenerateColumns property and let me know whether this helps.
<telerik:RadGrid ID="rgInvitesExport" runat="server" AutoGenerateColumns="false">
...

Kind regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Jeff Reinhardt
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or