refreshing a grid

4 posts, 0 answers
  1. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 02 Dec 2010 Link to this post

    I have a grid on a webpage that contains one or more locations.  Ive created a popup window that allows several locations to be selected at once and placed into a table.  How can I automatically refresh the grid when the popup window closes to reflect the new locations that were added.  I dont want a full page postback, just the location grid refreshed.

    Ive used this code but it doesnt work

    if (Request.Form["__EVENTTARGET"] != null)
                {
                    if (Request.Form["__EVENTARGUMENT"] != null)
                    {
                        ProcessRequest(Request.Form["__EVENTTARGET"].ToString(), Request.Form["__EVENTARGUMENT"].ToString());
                    }
     
                }

    private void ProcessRequest(string target, string argument)
            {
     
                if (!String.IsNullOrEmpty(target))
                {
                    if (target == "ArtistNameClick")
                    {
                        if (!String.IsNullOrEmpty(argument))
                        {
                            string[] arInfo = new string[2];
                            char[] splitter = { ' ' };
                            arInfo = argument.Split(splitter);
                            if (!String.IsNullOrEmpty(arInfo[0]))
                            {
                                switch (arInfo[0])
                                {
                                    case "~ArtistName":
                                        GetArtistData(arInfo[1]);
                                        break;
                                }
                            }
                        }
                    }
                }
     
                if (!String.IsNullOrEmpty(target) && !String.IsNullOrEmpty(argument))
                {
                    if (argument == "Rebind")
                    {
                        GetArtistData(this.HiddenUserID.Value);   
                    }
                    else if (argument == "RebindAndNavigate")
                    {
                        
     
                        this.RadGridTravelZones.MasterTableView.SortExpressions.Clear();
                        this.RadGridTravelZones.MasterTableView.GroupByExpressions.Clear();
                        this.RadGridTravelZones.MasterTableView.CurrentPageIndex = this.RadGridTravelZones.MasterTableView.PageCount - 1;
                        this.RadGridTravelZones.Rebind();
                           
                         
                    }
                }
                //}
            }

  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 07 Dec 2010 Link to this post

    Hello Mww,

    To achieve the desired functionality you could try ajaxifying the RadGrid as following:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>

    Then when the RadWindow is closed you could rebind the RadGrid by calling the MasterTableView.rebind function:
    function OnClientClose(sender, eventArgs)
    {
       $find("<%=RadGrid1.ClientID %>").get_masterTableView().rebind();
    }

    Additionally I am sending you a simple example which demonstrates the desired functionality.

    Greetings,
    Radoslav
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 17 Dec 2010 Link to this post

    Hi

    Ive tried your example, but the grid still wont refresh, heres what Ive got

    function OnClientClose(sender, eventArgs) {
                    $find("<%=RadGridTravelZones.ClientID %>").get_masterTableView().rebind();
                }

    as im using a master page, i have a proxy manager

    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnlSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlSearch" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadComboBoxType">
                <updatedcontrols>
                    <telerik:AjaxUpdatedControl ControlID="RadComboBoxType" />
                    <telerik:AjaxUpdatedControl ControlID="RadGridGenreCategories"
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </updatedcontrols>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGridGenreCategories">
                <updatedcontrols>
                    <telerik:AjaxUpdatedControl ControlID="RadGridGenreCategories"
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </updatedcontrols>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGridTravelZones">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGridTravelZones"
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGridBookingOptions">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGridBookingOptions"
                        LoadingPanelID="RadAjaxLoadingPanel3" />
                </UpdatedControls>
            </telerik:AjaxSetting>
             
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>


    and finally

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista">
                    <Windows>
                        
                        <telerik:RadWindow Skin="Vista" ID="ArtistPerformanceLocationDialog" OnClientClose="OnClientClose" runat="server" Title="Locations" Height="475px"
                            Width="300px" Left="150px" ReloadOnShow="true" Modal="true" />
                    </Windows>
                </telerik:RadWindowManager>

    can you help ?
  5. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 22 Dec 2010 Link to this post

    Hi Mww,

    Could you please try handling the OnClientClose event of the RadWindowManager  instead of RadWindow and let me know if the issue still exists:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientClose="OnClientClose" Skin="Vista">
      <Windows>
         <telerik:RadWindow Skin="Vista" ID="ArtistPerformanceLocationDialog" runat="server" Title="Locations" Height="475px" Width="300px" Left="150px" Modal="true" />
     </Windows>
    </telerik:RadWindowManager>

    Looking forward for your reply.

    All the best,
    Radoslav
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top