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

Can't edit RadGrid row after Export To Excel

2 Answers 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shane
Top achievements
Rank 1
Shane asked on 02 Jul 2013, 03:57 PM
I've been working on this for several days now and I've had no luck so far. I have a RadGrid that Exports to excel, actually, several RadGrids in the application. The grids export as expected. The problem is that once I've exported, I can't edit a row. Here's what I've found so far.

When I click the Export button, if I set a breakpoint in the ItemCommand handler, the command name is ExportToExcel, as it should be. Then, once it exports and the page is ready for use again, I click the Edit icon in the row. This time, in the ItemCommand handler, the command name is still ExportToExcel, it should be Edit at this point. In fact, the command source is the Export button, not the Edit button.

I've also set a break point in the master page in OnRequestStart. I can confirm that the Ajax postback is canceled when Export is clicked and that the Event Target is btnExpXls. But when I click Edit, after exporting, the event target is the Edit button. However, by the time it hits the server, even in the RequestStart event in Global.asax, the event target is the export button.

When I step through the script side code I can see the event target getting changed from EditButton to btnExpXls; this appears to be  happening in the script for RadScriptManager. But I can't access that script to make changes, obviously. I'm hoping this is a known issue and that there is a workaround for it. Any suggestions will be greatly appreciated.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Jul 2013, 09:18 AM
Hi Shane,

I tried like as you have said,but it works fine for me.Below is the code snippet i tried.I can edit after export.Please try the below code snippet.

ASPX:
<telerik:RadGrid ID="Radgrid1" runat="server" PageSize="5" DataSourceID="SqlDataSource2"
    AllowPaging="true" AutoGenerateEditColumn="true" AllowAutomaticUpdates="true">
    <ExportSettings ExportOnlyData="true" IgnorePaging="true">
    </ExportSettings>
    <MasterTableView AutoGenerateColumns="false" DataSourceID="SqlDataSource2" DataKeyNames="OrderID"
        CommandItemDisplay="Top">
        <CommandItemSettings ShowExportToExcelButton="true" />
        <Columns>
            <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" UniqueName="OrderID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" UniqueName="CustomerID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>  
</telerik:RadGrid>

If this doesn't help,please provide your code.

Thanks,
Princy
0
Kostadin
Telerik team
answered on 05 Jul 2013, 10:49 AM
Hi Shane,

Could you please provide your code declaration and the related code behind in order to investigate the issue further? Note that some controls persist their event arguments after the postback. In such cases, the described behavior could be observed as the state after the export command remains the same and any command will use those arguments.

Regards,
Kostadin
Telerik
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 the blog feed now.
Tags
General Discussions
Asked by
Shane
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kostadin
Telerik team
Share this question
or