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

[Solved] Refresh data on MVC Grid from javascript

1 Answer 367 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nicky Formosa
Top achievements
Rank 1
Nicky Formosa asked on 02 Aug 2010, 01:01 PM
Hi All,

i would like to ask if its possible to refresh/reload the data on the grid after an event has been fired using javascript. The problem i'm faced with is this:

I have a page having a form and a MVC grid. Once the form has been submitted (using ajax) i want to reload the grid with the new details, but i can't find a way to fire off the reload grid event.

Any help would be greatly appreciated.

Regards
Nick

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 10 Aug 2010, 02:35 PM
Hi


I try to find out this problem but did not turn out yet.
The way, what i used:
Rehearsed this first:
in grid i tried:
.ClientEvents(events => events.OnDataBound("onDataBound"))

and in js:
<script type="text/javascript">
             function onDataBound() {
                 var grid = $(this).data('tGrid');
                 grid.ajaxRequest();
            }
</script>

and this works Chrome and Firefox, but sometimes i get a popup, that "Error! The requested URL did not return JSON.".
I tried to find out  that refresh icon what is it doing, but very complex the telerik.grid.js.

I guess, the key is  the ajaxRequest() method, but i don't know how can we use.

Regards,
Richard

ps.:http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-client-api.html

Tags
General Discussions
Asked by
Nicky Formosa
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or