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

Close button and refreshGrid

11 Answers 192 Views
Grid
This is a migrated thread and some comments may be shown as answers.
NS
Top achievements
Rank 1
NS asked on 14 Jan 2008, 09:02 AM
Hello,
Using the regular telerik asp.net grid, I had a RadWindow that contains detail items of a record. (opens when clicking an item in a grid).

On the RadWindow, there is a button "Close this window". When hitting this button, the grid on the parent page automatically reloads its records. (this was done using: CloseAndRebind() and refreshGrid (javascript) as described in the Help files.

My question is how to do this with the Prometheus grid ?

Thanks,

11 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Jan 2008, 12:03 PM
Hello NS,

You can use fireCommand() client-side method to achieve this. Here is an example:

http://www.telerik.com/help/radcontrols/prometheus/grid_fireCommand.html

function refreshGrid()
{
  $find("<%= RadGrid1.MasterTableView.ClientID %>").fireCommand("RebindGrid","");
}

All the best,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
NS
Top achievements
Rank 1
answered on 14 Jan 2008, 12:21 PM
Thanks the fireCommand method works :-)

Another question:
is there some way to encapsulate or call the fireCommand method in an Ajax request ? (because calling the fireCommand command causes a postback of my page)
0
Vlad
Telerik team
answered on 14 Jan 2008, 12:23 PM
Hi NS,

If you ajaxify the grid using RadAjaxManager or panel all grid methods will be affected as well. Here is an example:

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

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Roel
Top achievements
Rank 1
answered on 15 Jan 2008, 09:25 PM
Hi,

I have the same set-up, but I am using the Prometheus "Futures" built.

However, the function below results in the error: "Object doesn't support this property or method"

function refreshGrid()

{

var masterTable = $find("<%= gridItems.ClientID %>").get_masterTableView();

masterTable.fireCommand(

"RebindGrid","");

}

The function refreshGrid is inside a telerik radcodeblock.

What am I doing wrong?

Regards
Roel

0
Sebastian
Telerik team
answered on 16 Jan 2008, 09:34 AM
Hello Roel,

Please excuse us if our previous reply confused you as it seems we made a mistake here. Actually such argument for the fireCommand client method is not supported and we plan to implement rebind client method which to invoke implicitly the server-side Rebind() method of RadGrid. This will most probably be included in the next version of RadGrid Prometheus.

In the meantime you may consider ajaxifying the grid through RadAjaxManager, trigger ajax request using the AjaxRequest(eventArgs) method of the manager and rebind the grid on the server inside the AjaxRequest handler.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Roel
Top achievements
Rank 1
answered on 16 Jan 2008, 02:52 PM
Hi,

I have tried Ajaxifying, but that didn't work.

I have defined the RadAjaxManager as:

<telerik:RadAjaxManager
    ID="RadAjaxManager1" 
    runat="server" >
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="cboUsers">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridItems" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="gridItems">            
            <
UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridItems" />
            
</UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

The client script to trigger the ajax request:

function refreshGrid()
{
    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
    ajaxManager.AjaxRequest();
}

And the server side event handler:

Protected Sub RadAjaxManager1_AjaxRequest( _
        
ByVal sender As Object, _
        ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) _
    Handles RadAjaxManager1.AjaxRequest
    
    Me
.gridItems.Rebind()

End Sub

Debugging: the code hits the refreshGrid function and subsequent the AjaxRequest event handler. I can see the data is being reloaded, but when the page is finished the grid is not updated. There are no script errors reported. After a manual refresh of the page the correct data is displayed. The page is inside a masterpage

Any clues?

0
Sebastian
Telerik team
answered on 16 Jan 2008, 03:31 PM
Hi Roel,

Can you please confirm that you are using the latest hotfix of RadControls Prometheus (Q3 2007 SP1) released yesterday? If the issue is not solved, I suggest you prepare a small working version of your project and send it enclosed to a formal support ticket. We will debug it locally and will get around to you with more info on the subject.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jeff
Top achievements
Rank 1
answered on 17 Jan 2008, 01:24 AM
Can you post this answer here as well? I opened a support ticket earlier for something similar, and also wanted to refresh the grid after closing.

Thanks,
Jeff
0
Roel
Top achievements
Rank 1
answered on 17 Jan 2008, 07:18 AM
Hi,

I have installed the 2007 3 1314 hotfix, but without effect.

I will create a small sample application and create a support ticket.

Roiel
0
Sebastian
Telerik team
answered on 17 Jan 2008, 09:14 AM
Hello Roel,

We will be expecting your example, feel free to post it in a support ticket once you are ready with it.

Kind regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Roel
Top achievements
Rank 1
answered on 17 Jan 2008, 01:39 PM
Hi Jeff,

The solution for my issue was simple: there was only one AjaxSetting missing, see the part in bold.

feedback from Telerik:
When you use the client-side AjaxRequest() method, initiator would be the respective Ajax control you use. So according to these, you need to add the following ajax setting in your AjaxManager:

see also http://www.telerik.com/help/aspnet/ajax/?ajxClientSideAPI.html

<
telerik:RadAjaxManager 
    ID="RadAjaxManager1" 
    runat="server" 
    
<AjaxSettings>

        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            
<UpdatedControls
>
                <telerik:AjaxUpdatedControl ControlID="gridItems" />

            
</UpdatedControls>
         </telerik:AjaxSetting
>

         <
telerik:AjaxSetting AjaxControlID="cboUsers">
             <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="gridItems" />
            </UpdatedControls>
         </telerik:AjaxSetting>
     </AjaxSettings>
</telerik:RadAjaxManager>

Tags
Grid
Asked by
NS
Top achievements
Rank 1
Answers by
Vlad
Telerik team
NS
Top achievements
Rank 1
Roel
Top achievements
Rank 1
Sebastian
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or