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

[Solved] Grid is not ajaxifying on other commanditemplate actions after export action is performed.

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunil
Top achievements
Rank 1
Sunil asked on 28 May 2013, 12:44 PM
we have a radgrid in a usercontrol created programatically and cusom command template created programatically having different buttons like links , export to excel, export to word , export to PDF and export to CSV.  grid is ajaxified by RadAjaxmanager. Ajax is disabled on export action.
below is the code snipped used to disable ajax on grid export.
   
  <telerik:RadScriptManager ID="RadGridListScriptManager" runat="server" />
   <telerik:RadCodeBlock ID="RadGridListCodeBlock" runat="server">    
  <script type="text/javascript">
  function onRequestStart(sender, args) {
                        if ((args.get_eventTarget().indexOf("ExportToExcelButton") >= 0) || (args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) || (args.get_eventTarget().indexOf("ExportToWordButton") >= 0) || (args.get_eventTarget().indexOf("ExportToPdfButton") >= 0)) {
                            args.set_enableAjax(false);
                        }
                    }

           </script>
           </telerik:RadCodeBlock>  
           <telerik:RadAjaxManager ID="RadGridListAjaxManager" runat="server">
             <ClientEvents OnRequestStart="onRequestStart" />
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGridList">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGridList" LoadingPanelID="RadGridListAjaxLoadingPanel" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>               
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel ID="RadGridListAjaxLoadingPanel" runat="server" Transparency="20"
                CssClass="MyAjaxLoadingPanel" BackColor="#E0E0E0">
                <table style="width: 100%; height: 100%;">
                    <tr style="height: 50%">
                        <td align="center" valign="middle" style="width: 50%">
                            <asp:Image ID="Image1" runat="server" AlternateText="Loading..." class="MyLoadingImage"
                                BorderWidth="0px" ImageUrl="~/images/loading1.gif"></asp:Image>
                        </td>
                    </tr>
                </table>
            </telerik:RadAjaxLoadingPanel>


The issue is when we export and then click on links , the same export action is getting performed and grid doesnot reloads.
I tried to use the below code for registerpostbackcontrols for export buttons but its not working after grid operations like filtering, paging,sorting is performed and exported.

Protected Sub RadGridList_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs)
 
  If (TypeOf e.Item Is GridCommandItem) Then
               Dim btncmd As ImageButton = TryCast(TryCast(e.Item, GridCommandItem).FindControl("ExportToExcelButton"), ImageButton)
               RadGridListScriptManager.RegisterPostBackControl(btncmd)
 
               btncmd = TryCast(TryCast(e.Item, GridCommandItem).FindControl("ExportToWordButton"), ImageButton)
               RadGridListScriptManager.RegisterPostBackControl(btncmd)
 
               btncmd = TryCast(TryCast(e.Item, GridCommandItem).FindControl("ExportToCsvButton"), ImageButton)
               RadGridListScriptManager.RegisterPostBackControl(btncmd)
 
               btncmd = TryCast(TryCast(e.Item, GridCommandItem).FindControl("ExportToPdfButton"), ImageButton)
               RadGridListScriptManager.RegisterPostBackControl(btncmd)
           End If
 
End Sub
we need your help on this at earliest.

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 31 May 2013, 08:57 AM
Hello Sunil,

I have replied to your ticket, so I would suggest you to close this forum and continue our conversation in the ticket.

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 their blog feed now.
Tags
Grid
Asked by
Sunil
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or