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

Performance Issues with Ajaxified Radgrid

1 Answer 57 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Smith
Top achievements
Rank 1
Smith asked on 20 Oct 2011, 11:35 PM
Hello,

I have a Ajaxified Grid that populates a sub grid using the OnRowSelected ClientEvent. It also opens a modal edit control with Javascript. This MasterRadGrid is rather large and takes a couple of seconds to load. The OnRowSelected even calls the rowSelected function.

function rowSelected(senders, args) {
    var ajaxManager = $find('<%= RadAjaxManager1.ClientID %>');
    var selectedIndex = args.get_itemIndexHierarchical();
    ajaxManager.ajaxRequestWithTarget('<%= MasterRadGrid.UniqueID %>', selectedIndex);
}

Which calls the RaisePostBackEvent...

protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
{
    try
    {
        viewstateColumnSequence = 0;
 
        base.RaisePostBackEvent(sourceControl, eventArgument);
        var grid = sourceControl as RadGrid;
 
        if (grid != null)
        {
            try
            {
                var gridItem = grid.Items[eventArgument];
                gridItem.FireCommandEvent(RadGrid.SelectCommandName, String.Empty);
            }
            catch { }
        }
    }
    catch (Exception ex)
    {
    }
}

Which fires the CommandEvent for select...

protected void MasterRadGrid_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    //Needed to reset the column created column names
    viewstateColumnSequence = 0;
 
    try
    {
        if (e.Item != null && e.Item.ItemIndex >= 0)
        {
            if (e.CommandName == "Select")
            {
                string tempCiIdHidden = ChildTabControl.myCiIdHidden.Value;
                HiddenField myCiIdHidden = (HiddenField)e.Item.FindControl("CiIdHidden");
                if (tempCiIdHidden != myCiIdHidden.Value)
                {
                    LoadChildGrid(myCiIdHidden.Value);
                }
 
                //Needed to persist the custom column template changes
                MasterRadGrid.Rebind();
            }
        }
    }
    catch (Exception ex)
    {
    }
}

My issue is that every time the row is selected, it raises a postback event that reloads the MasterRadGrid, whether the data needs refreshed or not. I'm stumped on how to raise the postback event to load the child grid but prevent the MasterRadGrid from reloading. Any ideas on what I'm missing or a direction you can point me in?

Thanks for taking a look.

Smith

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 26 Oct 2011, 08:19 AM
Hi Smith,

Note that it is not needed to rebind the MasterRadGrid in ItemCommand event. Actually the rebind will not ensure that the changes are persisted. The select command by default does not call rebind so it is not needed in your case also. Please remove the MasterRadGrid.Rebind() form the ItemCommand event and let me know how it goes.


Best wishes,
Maria Ilieva
the Telerik team
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
Ajax
Asked by
Smith
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or