Hello there---
I have set the PagingStyle-Mode to NextPrevAndNumeric and the numbers trigger the next page successfully, but the arrows do not. The only post (http://www.telerik.com/community/forums/aspnet-ajax/grid/viewstate-and-paging.aspx) I found in the forum regarding this issue did not completely address the solution I need. It references the use of a radUpdatePanel, which I can't find in the suite of controls. I tried implementing a RadAjaxPanel and I am currently using an ASP.NET UpdatePanel, but neither seems to get the arrows working properly. Can anyone shed any light on it for me?
Thanks!
---Keith
I have set the PagingStyle-Mode to NextPrevAndNumeric and the numbers trigger the next page successfully, but the arrows do not. The only post (http://www.telerik.com/community/forums/aspnet-ajax/grid/viewstate-and-paging.aspx) I found in the forum regarding this issue did not completely address the solution I need. It references the use of a radUpdatePanel, which I can't find in the suite of controls. I tried implementing a RadAjaxPanel and I am currently using an ASP.NET UpdatePanel, but neither seems to get the arrows working properly. Can anyone shed any light on it for me?
Thanks!
---Keith
<telerik:RadGrid ID="radGrdRequests" runat="server" AllowPaging="True" |
PageSize="3" PagerStyle-Mode="NextPrevAndNumeric" |
AutoGenerateColumns="False" Width="95%" HorizontalAlign="Center" |
Skin="Office2007" ClientSettings-Selecting-AllowRowSelect="true" |
AllowMultiRowSelection="True" GridLines="None"> |
6 Answers, 1 is accepted
0
Hello Keith,
The NextPrevAndNumeric grid pager type requires the viewstate of the control to be enabled. A possible solution for your case would be to store the grid viewstate in the Session (after it is enabled) as explained in this documentation topic.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
The NextPrevAndNumeric grid pager type requires the viewstate of the control to be enabled. A possible solution for your case would be to store the grid viewstate in the Session (after it is enabled) as explained in this documentation topic.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Keith
Top achievements
Rank 1
answered on 17 Apr 2009, 04:43 PM
Hey Sebastian---
Thanks for the reply... I assumed the default value for EnableViewState was true... but if the default value is false, how do the numeric pager links work successfully?
At any rate, I have enabled the ViewState for the RadGrid, but I still have the same level of success... pager number links work correctly, but the pager arrow links do not.
---Keith
Thanks for the reply... I assumed the default value for EnableViewState was true... but if the default value is false, how do the numeric pager links work successfully?
At any rate, I have enabled the ViewState for the RadGrid, but I still have the same level of success... pager number links work correctly, but the pager arrow links do not.
<telerik:RadGrid ID="radGrdRequests" runat="server" AllowPaging="True" |
PageSize="2" PagerStyle-Mode="NextPrevAndNumeric" EnableViewState="true" |
AutoGenerateColumns="False" Width="95%" HorizontalAlign="Center" |
Skin="Office2007" ClientSettings-Selecting-AllowRowSelect="true" |
AllowMultiRowSelection="True" GridLines="None"> |
---Keith
0
Hello Keith,
By default the grid ViewState is enabled (e.g. EnableViewState default value is true).
Additionally, I followed your scenario but was not able to replicate the issue.
Could you please elaborate a but more on your case? How is you grid bound for instance? If you could send us the grid declaration and any code connected to it, this could help in finding a resolution for you.
Find more about RadGrid data-binding in the below articles:
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html
http://www.telerik.com/help/aspnet-ajax/grdsimpledatabinding.html
http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html
Check it out and let me know how it goes.
Regards,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
By default the grid ViewState is enabled (e.g. EnableViewState default value is true).
Additionally, I followed your scenario but was not able to replicate the issue.
Could you please elaborate a but more on your case? How is you grid bound for instance? If you could send us the grid declaration and any code connected to it, this could help in finding a resolution for you.
Find more about RadGrid data-binding in the below articles:
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html
http://www.telerik.com/help/aspnet-ajax/grdsimpledatabinding.html
http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html
Check it out and let me know how it goes.
Regards,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Keith
Top achievements
Rank 1
answered on 23 Apr 2009, 05:50 PM
I notice that when using the numbers to move through the pager, I am successfully entering the if branch of the code-behind because the causedPostBack variable is populated properly with the ID of the RadGrid control (radGrdRequests), but when I use the arrows to move through the pager, the causedPostBack variable is populated with an empty string, so the if branch is passed over and the re-binding does not occur. Why wouldn't the arrow link of the pager populate the causedPostBack variable the same way the pager number link does? Thanks for any help you can offer with this issue... Here is the presentation page code...
And here is the code behind that binds the data to the RadGrid...
<asp:UpdatePanel ID="upViewRequests" runat="server"> |
<ContentTemplate> |
<telerik:RadGrid ID="radGrdRequests" runat="server" AllowPaging="True" |
PageSize="2" PagerStyle-Mode="NextPrevAndNumeric" EnableViewState="true" |
AutoGenerateColumns="False" Width="95%" HorizontalAlign="Center" |
Skin="Office2007" ClientSettings-Selecting-AllowRowSelect="true" |
AllowMultiRowSelection="True" GridLines="None"> |
<HeaderContextMenu> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</HeaderContextMenu> |
<PagerStyle Mode="NextPrevAndNumeric" /> |
<MasterTableView AlternatingItemStyle-HorizontalAlign="Left" |
HeaderStyle-BackColor="LightGray" ItemStyle-HorizontalAlign="Left"> |
<Columns> |
<telerik:GridBoundColumn DataField="ACCESSREQUESTSID" HeaderText="" |
UniqueName="ACCESSREQUESTSID" Visible="false"> |
</telerik:GridBoundColumn> |
<telerik:GridClientSelectColumn HeaderText="Access" UniqueName="AccessGranted"> |
<HeaderStyle HorizontalAlign="Center" Width="5%" /> |
<ItemStyle HorizontalAlign="Center" Width="5%" /> |
</telerik:GridClientSelectColumn> |
<telerik:GridTemplateColumn HeaderText="Requested" UniqueName="DateCreated"> |
<HeaderStyle HorizontalAlign="Center" Width="10%" /> |
<ItemStyle HorizontalAlign="Center" Width="10%" /> |
<ItemTemplate> |
<asp:Label ID="lblDateRequested" runat="server" |
Text='<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "DateCreated").ToString()).ToShortDateString() %>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Name" UniqueName="FullName"> |
<HeaderStyle Width="25%" /> |
<ItemStyle Width="25%" /> |
<ItemTemplate> |
<asp:Label ID="lblFullName" runat="server" |
Text='<%# BuildEmailLink(DataBinder.Eval(Container.DataItem, "FullName").ToString(), DataBinder.Eval(Container.DataItem, "Email").ToString()) %>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="FullUserName" HeaderText="User Name" |
UniqueName="UserName"> |
<HeaderStyle Width="20%" /> |
<ItemStyle Width="20%" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="DepartmentName" HeaderText="Department" |
UniqueName="DepartmentName"> |
<HeaderStyle Width="20%" /> |
<ItemStyle Width="20%" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="SolarwindsSite" |
HeaderText="Solarwinds Site(s)" UniqueName="SolarwindsSite"> |
<HeaderStyle Width="20%" /> |
<ItemStyle Width="20%" /> |
</telerik:GridBoundColumn> |
</Columns> |
<ItemStyle HorizontalAlign="Left" /> |
<AlternatingItemStyle HorizontalAlign="Left" /> |
<PagerStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" |
Font-Strikeout="False" Font-Underline="False" Mode="NextPrevAndNumeric" |
Wrap="True" /> |
<HeaderStyle BackColor="LightGray" /> |
</MasterTableView> |
<ClientSettings> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
<FilterMenu> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</FilterMenu> |
</telerik:RadGrid> |
</ContentTemplate> |
</asp:UpdatePanel> |
And here is the code behind that binds the data to the RadGrid...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
Dim causedPostBack As String = Page.Request.Params("__EVENTTARGET") |
If (Not causedPostBack Is Nothing AndAlso causedPostBack.Contains("radGrdRequests")) Or Not Me.Page.IsPostBack Then |
Dim connStr As String |
connStr = (ConfigurationManager.ConnectionStrings("DbConnectionString").ConnectionString) |
Dim sqlConn As New System.Data.SqlClient.SqlConnection(connStr) |
sqlConn.Open() |
Dim sqlComm As New SqlCommand() |
sqlComm.Connection = sqlConn |
sqlComm.CommandText = "SELECT statement here..." |
sqlComm.CommandType = CommandType.Text |
Dim sqlAdapter As New SqlDataAdapter(sqlComm) |
Dim dsRequests As New DataSet |
sqlAdapter.Fill(dsRequests) |
Me.radGrdRequests.DataSource = dsRequests.Tables(0) |
Me.radGrdRequests.DataMember = dsRequests.Tables(0).ToString() |
Me.radGrdRequests.DataBind() |
End If |
End Sub |
0
Hello Keith,
Using the Page.Request.Params collection for your conditional check to determine the control which initiated the postback is not recommended approach in this type of scenario.
Instead of binding the grid conditionally using simple binding with DataBind() calls, you can transform your code to take advantage of the advanced binding with NeedDataSource handling discussed previously in this thread. Thus you will not need to perform any conditional checks and merely bind the grid to data in its NeedDataSource handler.
Additionally, you will be able to utilize features like grouping, filtering, custom edit forms which are supported only with this type of binding or declarative data sources.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Using the Page.Request.Params collection for your conditional check to determine the control which initiated the postback is not recommended approach in this type of scenario.
Instead of binding the grid conditionally using simple binding with DataBind() calls, you can transform your code to take advantage of the advanced binding with NeedDataSource handling discussed previously in this thread. Thus you will not need to perform any conditional checks and merely bind the grid to data in its NeedDataSource handler.
Additionally, you will be able to utilize features like grouping, filtering, custom edit forms which are supported only with this type of binding or declarative data sources.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Keith
Top achievements
Rank 1
answered on 28 Apr 2009, 07:35 PM
Hey Sebastian---
Removing the databinding from the postback logic and Implementing the NeedDataSource event handler solved the problem. The paging arrow links now work fine. Thanks for the guidance!
---Keith
Removing the databinding from the postback logic and Implementing the NeedDataSource event handler solved the problem. The paging arrow links now work fine. Thanks for the guidance!
---Keith