I have developed an ASP.NET Dynamic Data site that also contains some custom pages using the DD features.
The site has been working fine for weeks, but all of a sudden this morning on one Page I am receiving the error:
Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. ...
This happens when I try and click the Next or Last button or try and change the page number on a asp:GridViewPager supplied as part of DD. This page has been working fine with multiple pages up until today.
This system is now live, so I would love any help or direction you can provide. Code inline below:
Default.aspx:
<%@ Page Language="C#" MasterPageFile="~/Requests.master" CodeFile="Default.aspx.cs" Inherits="ListRequests" %>
<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>
<%@ Register src="~/DynamicData/Content/FilterUserControl.ascx" tagname="DynamicFilter" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />
<h2>Your Virtual Server requests</h2>
<p>Only requests for user <asp:Label ID="labelUser" runat="server" Font-Bold="True" /> are show below.</p>
<p>Use the search function to find requests you did not submit.</p>
<asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
HeaderText="List of validation errors" />
<asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" />
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" AllowSorting="True" CssClass="gridview">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="DetailsHyperLink" runat="server"
NavigateUrl='<%# "/VRM/requests/ViewRequest.aspx?id=" + Eval("Request_id") %>'
Text="Details" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="footer"/>
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
You have not yet submitted any requests.
</EmptyDataTemplate>
</asp:GridView>
<br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Web.DynamicData;
public partial class ListRequests : System.Web.UI.Page {
protected void Page_PreInit(object sender, EventArgs e)
{
this.MasterPageFile = AppHelpers.DynamicMaster();
}
protected void Page_Init(object sender, EventArgs e) {
DynamicDataManager1.RegisterControl(GridView1, true/*setSelectionFromUrl*/);
}
protected void Page_Load(object sender, EventArgs e) {
VRMDataContext db = new VRMDataContext();
var rows = from p in db.Requests
where p.RequesterLogon.Equals(AppHelpers.CurrentUser())
orderby p.RequestDate descending
select new
{
Request_ID = p.id,
Server_Name = p.ServerName,
Date_Requested = p.RequestDate,
Stage = p.RequestStage.Name,
Environment = p.Environment.Name,
Location = p.Location.Name,
PU = p.PUperCPU,
CPUs = p.NumCPUs,
Replicated = p.Replicated,
LUN = p.LUNsize
};
GridView1.DataSource = rows;
GridView1.DataBind();
labelUser.Text = AppHelpers.CurrentUser();
}
protected void OnFilterSelectedIndexChanged(object sender, EventArgs e) {
GridView1.PageIndex = 0;
}
}
steddyman
Member
23 Points
82 Posts
PageRequestManagerServerErrorException with asp:GridViewPager
May 05, 2009 10:35 AM|LINK
I have developed an ASP.NET Dynamic Data site that also contains some custom pages using the DD features.
The site has been working fine for weeks, but all of a sudden this morning on one Page I am receiving the error:
Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. ...
This happens when I try and click the Next or Last button or try and change the page number on a asp:GridViewPager supplied as part of DD. This page has been working fine with multiple pages up until today.
This system is now live, so I would love any help or direction you can provide. Code inline below:
Default.aspx:
<%@ Page Language="C#" MasterPageFile="~/Requests.master" CodeFile="Default.aspx.cs" Inherits="ListRequests" %> <%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %> <%@ Register src="~/DynamicData/Content/FilterUserControl.ascx" tagname="DynamicFilter" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" /> <h2>Your Virtual Server requests</h2> <p>Only requests for user <asp:Label ID="labelUser" runat="server" Font-Bold="True" /> are show below.</p> <p>Use the search function to find requests you did not submit.</p> <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true" HeaderText="List of validation errors" /> <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" /> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" CssClass="gridview"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="DetailsHyperLink" runat="server" NavigateUrl='<%# "/VRM/requests/ViewRequest.aspx?id=" + Eval("Request_id") %>' Text="Details" /> </ItemTemplate> </asp:TemplateField> </Columns> <PagerStyle CssClass="footer"/> <PagerTemplate> <asp:GridViewPager runat="server" /> </PagerTemplate> <EmptyDataTemplate> You have not yet submitted any requests. </EmptyDataTemplate> </asp:GridView> <br /> </ContentTemplate> </asp:UpdatePanel> </asp:Content>Default.aspx.cs