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

radgrid ajax refresh not working

1 Answer 145 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 17 Sep 2011, 07:42 PM
Hi,

I'm using a rad grid to show line items for an invoice. Each row has an image button column used to delete the row when clicked.
I prefer to do this on the client and everything works fine until I call rebind to update the grid. It just doesn't work.The results in my data store show's the row has been delete. I am using a content page if that makes a difference. Here is my code. Thanks for your help.
function DeleteRow() {
             EstimateWebService.DeleteEstimateItems(rowId.Id, OnDeleteRowSucess)
         }
function OnDeleteRowSucess() {
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
         }
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
                    EnableViewState="false" onajaxrequest="RadAjaxManager1_AjaxRequest">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="btnAddNewRow">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdEstimateItems" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="grdEstimateItems" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                  <telerik:AjaxSetting AjaxControlID="grdEstimateItems">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="grdEstimateItems" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                </AjaxSettings>
           </telerik:RadAjaxManager>
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    if (e.Argument == "Rebind")
    {
        //RadGrid1.MasterTableView.SortExpressions.Clear();
        //RadGrid1.MasterTableView.GroupByExpressions.Clear();
        grdEstimateItems.Rebind();
    }
}

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 21 Sep 2011, 03:59 PM
Hi Ron,

Your ajax setup is proper. Can you confirm that after the grid Rebind() is called, the proper data is returned from the database? For that purpose, if the grid is bound though the NeedDataSource event, you can put a break point there and see what is the result. If the grid is bound to DataSource control, you can handle its Selected server-side event for the same.

Regards,
Iana Tsolova
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
Ron
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or