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

Radgrid rebind using javascript

5 Answers 323 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 17 Jun 2009, 04:33 PM
Hi

Having looked at some of the examples of people using radwindow and radgrid rebinds. I have worked on trying to get a radgrid rebind using javascript after altering some data in a modal window.

Although what i am trying gets only so far.

I call this following javascript function from the modal window

    function test()       
    {  
        var grid = $find("<%= RadGrid1.ClientID %>");  
        grid.ajaxRequest();      
    } 

the following code is called from the OnAjaxRequest="RadGrid1_AjaxRequest"  set in the telerik:RadAjaxManager
    protected void RadGrid1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
    {  
        RadGrid1.Rebind();  
    } 

on doing this i am getting an "object doesnt support this property method error"

Any help would be greatly appreciated.

Thanks

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 18 Jun 2009, 01:02 PM
Hi Greg,

The grid should be one of the controls updated by the ajax request and since the RadAjaxManager is initiating the asynchronous request, you need the following ajax setting:
ASPX:
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">     
                    <UpdatedControls>    
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />    
                    </UpdatedControls>    
                </telerik:AjaxSetting> 

Let me know if this helps.

All the best,
Pavlina
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
Greg
Top achievements
Rank 1
answered on 18 Jun 2009, 03:01 PM
Hi

Thanks for the reply, although unfortunately your suggestion didnt seem to work.

 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"   
                    OnAjaxSettingCreated="ajaxManager_AjaxSettingCreated" 
                    OnAjaxRequest="RadGrid1_AjaxRequest" > 
                        <AjaxSettings> 
                            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                                <UpdatedControls> 
                                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"/>  
                                </UpdatedControls> 
                            </telerik:AjaxSetting> 
                        </AjaxSettings> 
                    </telerik:RadAjaxManager> 

I tried removing OnAjaxSettingCreated="ajaxManager_AjaxSettingCreated" thinking this may have been causing a conflict with what you suggested but that was not the case.

Any other suggestions would be greatly appreciated.

Thanks
0
Accepted
Pavlina
Telerik team
answered on 22 Jun 2009, 01:29 PM
Hello Greg,

Could you please try to modify the javascript function as shown bellow and let me know if it makes any difference.
JS:
 function test()          
    {     
        var grid = $find("<%= RadAjaxManager1.ClientID %>");     
        grid.ajaxRequest();         
    }   
 

I hope this helps.

Kind regards,
Pavlina
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
Greg
Top achievements
Rank 1
answered on 01 Jul 2009, 10:21 AM
Hi

Sorry for the long delay in replying, but yes thats now working.

Thanks
0
Robert
Top achievements
Rank 1
answered on 18 Jun 2012, 01:44 PM
I'd like to share another way of reloading a radgrid using javascript instead of ajax.

In the OnClientClosed event, do the following:
var masterTable = window.$find("<%= RadGridToReload.ClientID %>").get_masterTableView();
masterTable.rebind();
document.forms["form1"].submit();

That causes a rebind and a submit of the form.
Tags
Grid
Asked by
Greg
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Greg
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Share this question
or