Hello,
I've got a RadAjaxPanel, which contains a RadGrid, which contains some ASP buttons inside its CommandItemTemplate, including an Export To Excel button, which exports that grid's data. The button itself works fine and the excel file is returned. But after exporting, if I click my Update button elsewhere on the page, after the postback, the Excel file pops up again!
I've tested with different scenarios and found that any of my buttons in that panel are getting re-called if they're called once and then a subsequent button is clicked. I tried moving the buttons outside of the grid, and the same thing happened. I moved the buttons outside of the panel, and the problem went away... but of course then the buttons no longer use AJAX and are not nicely placed in the grid where they belong. =)
So any idea what would cause the button's click event to happen even when it wasn't that button that was clicked? It's almost like it's stored that a click should happen and it keeps clicking the button on every postback, no matter what actually caused it.
It's on a very complex page, but here are some code snippets that might be applicable.
I've got a RadAjaxPanel, which contains a RadGrid, which contains some ASP buttons inside its CommandItemTemplate, including an Export To Excel button, which exports that grid's data. The button itself works fine and the excel file is returned. But after exporting, if I click my Update button elsewhere on the page, after the postback, the Excel file pops up again!
I've tested with different scenarios and found that any of my buttons in that panel are getting re-called if they're called once and then a subsequent button is clicked. I tried moving the buttons outside of the grid, and the same thing happened. I moved the buttons outside of the panel, and the problem went away... but of course then the buttons no longer use AJAX and are not nicely placed in the grid where they belong. =)
So any idea what would cause the button's click event to happen even when it wasn't that button that was clicked? It's almost like it's stored that a click should happen and it keeps clicking the button on every postback, no matter what actually caused it.
It's on a very complex page, but here are some code snippets that might be applicable.
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"AttorneyPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"ButtonsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"DocumentsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"FundingsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"CaseCountsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RemindersPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"ReductionPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"AttorneyPanel"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"FundingsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"DocumentsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"CaseCountsPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"ButtonsPanel"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"FundingsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"DocumentsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"CaseCountsPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RemindersPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxPanel
ID
=
"CaseListPanel"
runat
=
"server"
ClientEvents-OnRequestStart
=
"requestStart"
EnableAJAX
=
"true"
OnAjaxRequest
=
"CaseListPanel_AjaxRequest"
>
<
div
class
=
"box"
style
=
"width:95%;"
align
=
"center"
>
<
div
class
=
"boxheader"
>Attorney Case List</
div
>
<
telerik:RadGrid
ID
=
"CaseListGrid"
runat
=
"server"
AllowSorting
=
"True"
AllowPaging
=
"False"
OnNeedDataSource
=
"CaseListGrid_NeedDataSource"
OnPreRender
=
"CaseListGrid_PreRender"
OnItemDataBound
=
"CaseListGrid_ItemDataBound"
Skin
=
"Oasis"
EnableEmbeddedSkins
=
"false"
Width
=
"100%"
AllowFilteringByColumn
=
"true"
SortingSettings-EnableSkinSortStyles
=
"false"
OnItemCreated
=
"CaseListGrid_ItemCreated"
>
<
ClientSettings
AllowColumnsReorder
=
"true"
>
<
Scrolling
AllowScroll
=
"False"
UseStaticHeaders
=
"True"
/>
<
Resizing
AllowColumnResize
=
"true"
/>
<
ClientEvents
OnGridCreated
=
"GridCreated3"
/>
</
ClientSettings
>
<
MasterTableView
AllowMultiColumnSorting
=
"True"
AutoGenerateColumns
=
"False"
AllowFilteringByColumn
=
"true"
TableLayout
=
"Auto"
CommandItemDisplay
=
"Top"
ClientDataKeyNames
=
"CaseId"
>
<
CommandItemTemplate
>
<
asp:Button
ID
=
"DownloadPDF"
runat
=
"server"
Text
=
"Create Pdf"
OnCLick
=
"downloadPdf_Click"
/>
<
asp:Button
ID
=
"DownloadExcel"
runat
=
"server"
Text
=
"Create Excel"
OnClick
=
"downloadXLS_Click"
/>
<
asp:Button
ID
=
"showsum"
Text
=
"Show All"
OnClick
=
"show_all_Click"
runat
=
"server"
/>
</
CommandItemTemplate
>
protected void downloadXLS_Click(object sender, EventArgs e)
{
CaseListGrid.MasterTableView.ExportToExcel();
}