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

[Solved] AjaxManager does not refresh Grid: what am I doing wrong?

3 Answers 209 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 30 Apr 2009, 04:49 PM
Dear all,

I think (hope?) that it is simple but can't see why my grid is not refreshing...

I have a (ASP) table holding four filter criteria used to select data displayed in the grid.
My controls have auto post and I know they fire since I can debug the Page_Load event but for some reason my grid does not refresh on the browser.

Could you spot if I am doing something drastically wrong?

Through RadAjaxManager, I am asking to refresh the grid based on the ASP table (can't see the controls in RadAjaxManager smart tag) and/or RadAjaxManager itself.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AttributesV3.aspx.cs" Inherits="FoxAdmin.AttributesV3" 
    EnableEventValidation="false" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Src="Controls/DisplayErrorV3.ascx" TagName="DisplayError" TagPrefix="uc2" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div id="HiddenFields" style="visibility: hidden"
        <asp:HiddenField ID="txtNodeKey" runat="server" /> 
        <asp:HiddenField ID="txtShowFVOptions" runat="server" Value="1" /> 
    </div> 
    <div> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
        </telerik:RadWindowManager> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGridAttributes" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="tblFilterOptions"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGridAttributes" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
         
        <asp:UpdatePanel ID="updError" runat="server" UpdateMode="Always"
            <ContentTemplate> 
                <uc2:DisplayError ID="DisplayError1" runat="server" /> 
            </ContentTemplate> 
        </asp:UpdatePanel> 
         
        <asp:Table ID="tblFilterOptions" runat="server" HorizontalAlign="Center" ToolTip="Filter the Properties" 
            Width="100%" BorderStyle="Solid"
            <asp:TableRow> 
                <asp:TableCell ID="tcPropertyTypeFilter" runat="server"
                    &nbsp;Type: 
                    <telerik:RadTextBox ID="txtPropertyDescFilter" runat="server" Wrap="False" AutoPostBack="True" 
                        Width="75px" /> 
                </asp:TableCell> 
                <asp:TableCell ID="tcPropertyGroup" runat="server"
                    &nbsp;Group: 
                    <telerik:RadComboBox ID="cboPropertyGroup" runat="server" Width="150px" AutoPostBack="True" 
                        NoWrap="True" DropDownWidth="250px" /> 
                </asp:TableCell> 
                <asp:TableCell ID="tcDataType" runat="server"
                    &nbsp;Data Type: 
                    <telerik:RadComboBox ID="cboDataType" runat="server" Width="80px" AutoPostBack="True" 
                        NoWrap="True" DropDownWidth="100px" /> 
                </asp:TableCell> 
                <asp:TableCell ID="tcFutureValues" runat="server"
                    &nbsp;Future Values: 
                    <telerik:RadComboBox ID="cboFutureValues" runat="server" Width="70px" AutoPostBack="True" 
                        NoWrap="True" DropDownWidth="100px" /> 
                </asp:TableCell> 
            </asp:TableRow> 
        </asp:Table> 
         
        <telerik:RadGrid ID="RadGridAttributes" runat="server" OnNeedDataSource="RadGridAttributes_NeedDataSource" 
            AutoGenerateColumns="False" GridLines="None" EnableViewState="False" AllowCustomPaging="True" 
            AllowPaging="True"
            <MasterTableView CellSpacing="-1" EnableViewState="false"
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="mp_Key" HeaderText="Property Key" UniqueName="column" 
                        Display="false" /> 
                    <telerik:GridBoundColumn DataField="pt_Desc" HeaderText="Property Type" UniqueName="column" 
                        Display="true" /> 
                    <telerik:GridBoundColumn DataField="DataValue" HeaderText="Value" UniqueName="column" 
                        Display="true" /> 
                    <telerik:GridBoundColumn DataField="mp_ValidFrom" HeaderText="ValidFrom" UniqueName="column" 
                        DataFormatString="{0:dd/MM/yyyy}" Display="true" /> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings> 
                <Selecting AllowRowSelect="True" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 
 

Thanks for your time


Eric

3 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 30 Apr 2009, 05:00 PM
I just found a way to make it work but I am not sure if that's the right answer...

I have put my grid into an Ajax UpdatePanel with UpdateMode "Always".

Should not I be able to set this up nice and easy just through the Rad Ajax Manager?
0
Sebastian
Telerik team
answered on 04 May 2009, 11:36 AM

Hello Eric,

If setting the update mode of the MS UpdatePanel to Always is applicable solution for your case, you can force the update panels injected by the ajax manager instance to update their content on each submit intercepting the OnAjaxSettingCreating event of the manager as follows:

Protected Sub RadAjaxManager1_AjaxSettingCreating(ByVal sender As ObjectByVal e As AjaxSettingCreatingEventArgs)  
 If (Not e.Initiator.ID.IndexOf("tblFilterOptions") = 0) Or (Not e.Initiator.ID.IndexOf("RadAjaxManager1") = 0) Then 
   e.UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Always  
 EndIf  
End Sub  

More information about this server event can be gathered from this help topic.

Kind regards,

Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eric
Top achievements
Rank 1
answered on 05 May 2009, 02:08 PM
Just for the records, I ended up changing quite a few things.

Main one was to change the ASP:Table into a simple HTML element as the table was preventing access to the events of the underlying elements... which prevented me from triggereing a Rebind() of the Grid...

Why does it all have to be so complicated??? :-(

Anyway, it works

Tags
Ajax
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or