Hello,
I know Telerik Grid does not go back to previous state in case of paging when ajaxfied but i found from telerik we can impement Scriptmanager Naviate method to reset Index but its not working it always go for first index on browser back button.
I have scriptmanager in MasterPage and in webpart i have added script manage Proxy control.
Please find code
in Webpart .ascx File
Code
Thanks
Ronak
I know Telerik Grid does not go back to previous state in case of paging when ajaxfied but i found from telerik we can impement Scriptmanager Naviate method to reset Index but its not working it always go for first index on browser back button.
I have scriptmanager in MasterPage and in webpart i have added script manage Proxy control.
Please find code
<
asp:ScriptManager
id
=
"ScriptManager"
runat
=
"server"
EnableHistory
=
"true"
EnablePageMethods
=
"false"
EnablePartialRendering
=
"true"
EnableScriptGlobalization
=
"true"
EnableScriptLocalization
=
"true"
/>
in Webpart .ascx File
<
asp:ScriptManagerProxy
ID
=
"wsScriptManagerProxy"
runat
=
"server"
OnNavigate
=
"ScriptManager_Navigate"
/>
Code
private
static
string
pageKey =
"p"
;
protected
void
ScriptManager_Navigate(
object
sender, HistoryEventArgs e)
{
if
(e.State.Count <= 0)
{
// Setup default state
workspaceGrid.MasterTableView.CurrentPageIndex = 0;
return
;
}
string
key = e.State.AllKeys[0];
string
state = String.Empty;
if
(String.Equals(key, pageKey))
{
state = e.State[key];
int
pageIndex =
int
.Parse(state);
workspaceGrid.MasterTableView.CurrentPageIndex = pageIndex;
workspaceGrid.MasterTableView.Rebind();
}
}
protected
void
workspaceGrid_PageIndexChanged(
object
sender, GridPageChangedEventArgs e)
{
//string state = (sender as RadGrid).MasterTableView.CurrentPageIndex.ToString();
string
state = e.NewPageIndex.ToString();
ScriptManager.GetCurrent(
this
.Page).AddHistoryPoint(pageKey, state);
}
Thanks
Ronak