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

RadGrid Postback and Ajax problem...

2 Answers 161 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 14 Oct 2010, 08:59 PM
Hi,

    I have a problem with RadGrid and Ajax. 
    Scenario:

    1. Im using Master pages and content pages.
    2. Im using RadAjaxManager at MasterPage and RadAjaxManagerProxy at content page.
    3. I have other controls that use ajax over the RadGrid for updating.
    4. Im using advanced databind for RadGrid ( NeedDataSource event) with List<Object> as datasource

Ok, the problem is that the LoadingAjaxPanel or Ajax effect doesnt works all the time. For example, if i try to sort any column or try to go to the next page or anyevent of the grid the ajax effect works (i mean the LoadingAjaxPanel works), but at the next action sorting, or paging or any, the complete page update like a postback, then i try to do another action adn the Ajax effects works again. I folowed all the examples for this but i dont know whta is wrong with the ajax part.

Some code here:
MasterPage
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
                <script type="text/javascript">
                function mngRequestStarted(ajaxManager, eventArgs)
                {
                    if ((eventArgs.EventTarget.indexOf("GridExportToCSV") != -1) ||
                        (eventArgs.EventTarget.indexOf("GridExportToXLS") != -1)                   {
                     eventArgs.EnableAjax = false;
                  }
                }
                </script>
  
            </telerik:RadCodeBlock>
    <telerik:RadScriptManager ID="tsmGeneric" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="mainAjaxManager" runat="server" ClientEvents-OnRequestStart="mngRequestStarted">
                <ClientEvents OnRequestStart="mngRequestStarted" />
    </telerik:RadAjaxManager>
.
.
.
<asp:ContentPlaceHolder ID="cphMainContent" runat="server">
                    </asp:ContentPlaceHolder>

ContentPage:
(Ajax Section)
<asp:Content ID="cntMain" ContentPlaceHolderID="cphMainContent" runat="server">
  
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="gvwOperations">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvwOperations" LoadingPanelID="rlpLoading"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="dropPeriods" >
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvwOperations" LoadingPanelID="rlpLoading"/>
                    <telerik:AjaxUpdatedControl ControlID="pnlDateRange"/>
                </UpdatedControls>                
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="dropUsers" >
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvwOperations" LoadingPanelID="rlpLoading"/>
                </UpdatedControls>                
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnGO">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvwOperations" LoadingPanelID="rlpLoading"/>
                </UpdatedControls>
            </telerik:AjaxSetting>            
        </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadAjaxLoadingPanel ID="rlpLoading" runat="server" Skin="Windows7" />

(RadGrid Section)
<telerik:RadGrid ID="gvwOperations" runat="server" 
            AllowPaging="True" 
            AutoGenerateColumns="False" 
            GridLines="None" 
            Skin="Windows7" 
            AllowSorting="True" 
            OnNeedDataSource="gvwOperations_NeedDataSource" 
            OnItemCommand="gvwOperations_ItemCommand" 
              onitemcreated="gvwOperations_ItemCreated" 
              onitemdatabound="gvwOperations_ItemDataBound">
            <ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True">
                <Pdf PageWidth="297mm" PageHeight="210mm" />
            </ExportSettings>
            <ClientSettings EnableRowHoverStyle="true" ReorderColumnsOnClient="false" AllowKeyboardNavigation="true" >
            <Resizing AllowColumnResize="true" EnableRealTimeResize="true" />
            </ClientSettings>
            <MasterTableView CommandItemDisplay="Top" TableLayout="Fixed" 
            PageSize="6"
            BorderStyle="None"
            EnableHeaderContextMenu="true" 
            EnableHeaderContextFilterMenu="true"
            IsFilterItemExpanded="false"
            AllowFilteringByColumn="True">
                <CommandItemTemplate>
                <asp:CheckBox ID="chkAllowGroup" runat="server" Text="Allow Group Columns" TextAlign="Right" Checked="false" OnCheckedChanged="chkAllowGroup_CheckedChanged"/>
                <asp:Button ID="GridExportToCSV" runat="server" Text="CSV" OnClick="btnDownloadCSV_Click"/>
                <asp:Button ID="GridExportToXLS" runat="server" Text="Excel" OnClick="btnDownloadXLS_Click"/>
                </CommandItemTemplate>
  
                <CommandItemSettings />
                <Columns>                
                    <telerik:GridBoundColumn DataField="ProcessDateTime" HeaderStyle-Width="150px" DataType="System.DateTime" HeaderText="ProcessDateTime"
                        SortExpression="ProcessDateTime" UniqueName="ProcessDateTime" meta:resourcekey="GridBoundColumnResource1">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="OperationID" HeaderStyle-Width="120px" HeaderText="OperationID" SortExpression="OperationID"
                        UniqueName="OperationID" meta:resourcekey="GridBoundColumnResource2">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="TransactionID" HeaderText="TransactionID" DataType="System.Int32"
                        SortExpression="TransactionID" UniqueName="TransactionID" meta:resourcekey="GridBoundColumnResource3">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MerchantSalesID" HeaderText="MerchantSalesID"
                        SortExpression="MerchantSalesID" UniqueName="MerchantSalesID" meta:resourcekey="GridBoundColumnResource4">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Currency" HeaderText="Currency" SortExpression="Currency"
                        UniqueName="Currency" meta:resourcekey="GridBoundColumnResource5">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Amount" DataType="System.Decimal" DataFormatString="{0:0.00}"
                        HeaderText="Amount" SortExpression="Amount" UniqueName="Amount" meta:resourcekey="GridBoundColumnResource6">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ToCurrency" HeaderText="ToCurrency" SortExpression="ToCurrency"
                        UniqueName="ToCurrency" meta:resourcekey="GridBoundColumnResource7">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ToAmount" DataType="System.Decimal" DataFormatString="{0:0.00}"
                        HeaderText="ToAmount" SortExpression="ToAmount" UniqueName="ToAmount" meta:resourcekey="GridBoundColumnResource8">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Estado" HeaderStyle-Width="55px" UniqueName="State" meta:resourcekey="GridTemplateColumnResource1">
                        <ItemTemplate>
                            <asp:Image ID="imgStatus" runat="server" BorderWidth="0px" 
                                ImageUrl='<%# String.Format("~/Images/{0}.png", Eval("LastStatus")) %>'
                                ToolTip='<%# GetLocalResourceObject(String.Format("tooltip{0}Transaction", Eval("LastStatus"))).ToString() %>'
                                AlternateText='<%# GetLocalResourceObject(String.Format("alternateTxt{0}Transaction", Eval("LastStatus"))).ToString() %>' />
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"  />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="UserCompleteName" HeaderText="UserCompleteName"
                        SortExpression="UserCompleteName" UniqueName="UserCompleteName" meta:resourcekey="GridBoundColumnResource9">
                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" Visible="false"
                        SortExpression="CustomerID" UniqueName="CustomerID" meta:resourcekey="GridBoundColumnResource10">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CustomerName" HeaderText="CustomerName" Visible="false"
                        SortExpression="CustomerName" UniqueName="CustomerName" meta:resourcekey="GridBoundColumnResource11">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CustomerEmail" HeaderText="CustomerEmail" Visible="false"
                        SortExpression="CustomerEmail" UniqueName="CustomerEmail" meta:resourcekey="GridBoundColumnResource12">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <PagerStyle Mode="NextPrevAndNumeric" />
        </telerik:RadGrid>

I ll attach some images so you can understand me better.

By the way the others controls (buttons and combobox) that use ajax over the RadGrid WORKS FINE ALL THE TIME.

I hope you can help me because its urgent.
thank you very much.

2 Answers, 1 is accepted

Sort by
0
Accepted
Mira
Telerik team
answered on 20 Oct 2010, 08:56 AM
Hello Luis,

I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.

Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

Regards,
Mira
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
0
Luis
Top achievements
Rank 1
answered on 21 Oct 2010, 10:26 PM
Hi Mira,

Thanks for your help, the problem was that in my MasterPage.aspx there was a <asp:UpdatePanel> for header and that controls makes the problem with RadAjax i changed it for a normal panel and all is ok now. Thank you very much :D.


Best Regards
-Luis
Tags
Grid
Asked by
Luis
Top achievements
Rank 1
Answers by
Mira
Telerik team
Luis
Top achievements
Rank 1
Share this question
or