Hi,
I'm having a problem with the paging buttons. The initial buttons 1-10 works just fine, but when I go to "..." (landing at 11), all the buttons will update their text, but will still be bound to the same events as their previous button IDs had, meaning that if I press 17, I end up back on back 8.
I've searched your forums for similar issues and found http://www.telerik.com/community/forums/aspnet-ajax/grid/355586-radgrid-paging-problem.aspx however this did not help me on the way to a solution.
In order to do some error searching, I've dumbed down an example as much as possible, leaving me with :
And codebehind:
If I instead of NumericPages use NextPrevAndNumeric, the same problem exists, but the Next button will always point at page 2, no matter which page I am on.
I'm having a problem with the paging buttons. The initial buttons 1-10 works just fine, but when I go to "..." (landing at 11), all the buttons will update their text, but will still be bound to the same events as their previous button IDs had, meaning that if I press 17, I end up back on back 8.
I've searched your forums for similar issues and found http://www.telerik.com/community/forums/aspnet-ajax/grid/355586-radgrid-paging-problem.aspx however this did not help me on the way to a solution.
In order to do some error searching, I've dumbed down an example as much as possible, leaving me with :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SimpleView.ascx.cs" Inherits="AccessToWeb.Web.SimpleView" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
telerik:RadScriptManager
ID
=
"RadScriptManager"
runat
=
"server"
></
telerik:RadScriptManager
>
<!-- content start -->
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
style
=
"padding-left:20px;"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
AllowPaging
=
"True"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
GridLines
=
"None"
EnableViewState
=
"true"
>
<
MasterTableView
EnableViewState
=
"true"
/>
<
PagerStyle
Mode
=
"NumericPages"
/>
</
telerik:RadGrid
>
</
div
>
And codebehind:
namespace
AccessToWeb.Web
{
public
partial
class
SimpleView : System.Web.UI.UserControl
{
private
string
_con, _query;
protected
void
Page_Load(
object
sender, EventArgs e)
{
_con = Sitecore.Context.Item[
"Connectionstring"
];
_query = Sitecore.Context.Item[
"Select statement"
];
if
(
string
.IsNullOrEmpty(_con) ||
string
.IsNullOrEmpty(_query))
{
this
.Visible =
false
;
return
;
}
}
public
DataTable GetDataTable(
string
query)
{
SqlConnection conn =
new
SqlConnection(_con);
SqlDataAdapter adapter =
new
SqlDataAdapter();
adapter.SelectCommand =
new
SqlCommand(query, conn);
DataTable myDataTable =
new
DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return
myDataTable;
}
protected
void
RadGrid1_NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = GetDataTable(_query);
}
}
}
If I instead of NumericPages use NextPrevAndNumeric, the same problem exists, but the Next button will always point at page 2, no matter which page I am on.