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

refreshing a grid

3 Answers 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 02 Dec 2010, 06:54 PM
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();
                       
                     
                }
            }
            //}
        }

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 07 Dec 2010, 02:00 PM
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.
0
mww
Top achievements
Rank 1
answered on 17 Dec 2010, 04:37 PM
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 ?
0
Radoslav
Telerik team
answered on 22 Dec 2010, 02:17 PM
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.
Tags
Grid
Asked by
mww
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
mww
Top achievements
Rank 1
Share this question
or