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

[Solved] Manually Refresh Grid

2 Answers 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ronald
Top achievements
Rank 1
ronald asked on 25 Mar 2011, 04:16 AM
Hi,

Is there a way to refresh the grid from javascript? I have a jquery dialog and once the user has added the new record then it close teh dialog and refresh the grid.. how can i refresh teh grid programatically?

2 Answers, 1 is accepted

Sort by
0
Henry
Top achievements
Rank 1
answered on 25 Mar 2011, 12:34 PM
I dont have the code here with me but its something along the lines of:

Javascript:

function UpdateGrid(id) {
var grid = $("GridName").data("tGrid");
grid.rebind({ PerameterNameToPass: id });
}

There does seem to be a bug with telerik's new release when you manually rebind it. If you try to then sort/update/page the grid it will revert back to the default value. This is NOT how the last release worked. It seems to loose the new value you pass it. The only way I have found as a work around right now is storing the value in a session variable.

EG:

Inside the action:
 if (Id != 0 || Session["SelectedID"] == null) { Session["SelectedID"] = Id; }
            else { Id = Int32.Parse(Session["SelectedID"].ToString()); }
Then use this to gather your results.

Hope this helps. And hopefully the bug will be sorted soon .... Its actually led to us stopping using the grids and probably moving away from Telerik.
0
Cristiano
Top achievements
Rank 1
answered on 18 May 2011, 08:59 PM
I'd like to rebind programmatically too, but your snippet doesn't work for me
$("GridName") it's ok
but .data("tGrid") is undefined -> what is the meaning of data() parameter?
Tags
Grid
Asked by
ronald
Top achievements
Rank 1
Answers by
Henry
Top achievements
Rank 1
Cristiano
Top achievements
Rank 1
Share this question
or