annbransom
08-25-2006, 02:21 AM
When my users have a gridview that has more than one page, they are getting an error when they try to click on a any page besides the first one. Below is the stack trace and the code. Help!
Error Message:
[HttpException (0x80004005): The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.]
System.Web.UI.WebControls.GridView.OnPageIndexChan ging(GridViewPageEventArgs e) +1427331
System.Web.UI.WebControls.GridView.HandlePage(Int3 2 newPage) +83
System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +488
System.Web.UI.WebControls.GridView.RaisePostBackEv ent(String eventArgument) +199
System.Web.UI.WebControls.GridView.System.Web.UI.I PostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Project Code:
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Discussion.aspx.vb" Inherits="Discussion" title="Group Discussions" debug=true%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table align="center" cellpadding="10" width="760">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="12pt" Text="Label" Font-Names="Arial" ForeColor="Purple"></asp:Label></td>
</tr>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ThreadID" AllowPaging="True" BorderColor="#f10383" BorderWidth="1px" GridLines="Horizontal" HorizontalAlign="Center" Width="700px">
<Columns>
<asp:ButtonField CommandName="Select" HeaderText="Subject" ShowHeader="True" Text="View Messages" DataTextField="Subject" />
<asp:BoundField DataField="Username" HeaderText="Author" />
<asp:BoundField DataField="Replies" HeaderText="Replies" />
<asp:BoundField DataField="LastPostDate" HeaderText="Original Post" ApplyFormatInEditMode="True" DataFormatString="{0:d}" HTMLEncode=False>
<ItemStyle HorizontalAlign="Right" Width="100px" />
</asp:BoundField>
</Columns>
<HeaderStyle BackColor="#F10380" Font-Bold="True" Font-Names="Arial" Font-Size="12pt" ForeColor="White" HorizontalAlign="Left" VerticalAlign="Top" />
<AlternatingRowStyle BackColor="Honeydew" />
</asp:GridView>
</td>
</tr>
<tr>
<td>
<table align="center" width="700">
<tr>
<td>
<table style="border-right: #f10383 1px solid; border-top: #f10383 1px solid; border-left: #f10383 1px solid; border-bottom: #f10383 1px solid" width="300" cellpadding="0" cellspacing="0">
<tr>
<td style="font-weight: bold; font-size: 12pt; width: 480px; color: white; font-family: Arial; background-color: #f10380">
&nbsp;Start a new thread</td>
</tr>
<tr>
<td style="width: 480px; height: 39px">
&nbsp;Subject:&nbsp;
<asp:TextBox ID="TextBox1" runat="server" Width="327px" MaxLength="190"></asp:TextBox></td>
</tr>
<tr>
<td align="center" style="width: 480px">
<asp:Button ID="Button1" runat="server" Text="Start Thread" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
[b]
[b]
&nbsp;[b]
[b]
[b]
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder2">
<asp:Label ID="lblGroupName" runat="server" Text="Label" ForeColor="White"></asp:Label>[b]
</asp:Content>
<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolder3">
<asp:Menu ID="Menu2" runat="server" DynamicHorizontalOffset="10" Font-Bold="True" Font-Names="Arial" Font-Size="12pt" ForeColor="#0000C0" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False" Visible="False">
<DynamicHoverStyle ForeColor="Lime" />
<DynamicMenuStyle BackColor="#F10380" Height="50px" HorizontalPadding="3px" VerticalPadding="3px" />
<DynamicMenuItemStyle Font-Size="10pt" />
<Items>
<asp:MenuItem NavigateUrl="~/groupadmin.aspx" Text="Admin" Value="Logout"></asp:MenuItem>
</Items>
<StaticHoverStyle ForeColor="#F10383" />
</asp:Menu>
</asp:Content>
<asp:Content ID="Content4" runat="server" ContentPlaceHolderID="ContentPlaceHolder4">
<asp:Label ID="Label4" runat="server" Font-Size="12pt" Text="Label"></asp:Label></asp:Content>
Error Message:
[HttpException (0x80004005): The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.]
System.Web.UI.WebControls.GridView.OnPageIndexChan ging(GridViewPageEventArgs e) +1427331
System.Web.UI.WebControls.GridView.HandlePage(Int3 2 newPage) +83
System.Web.UI.WebControls.GridView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +488
System.Web.UI.WebControls.GridView.RaisePostBackEv ent(String eventArgument) +199
System.Web.UI.WebControls.GridView.System.Web.UI.I PostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Project Code:
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Discussion.aspx.vb" Inherits="Discussion" title="Group Discussions" debug=true%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table align="center" cellpadding="10" width="760">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="12pt" Text="Label" Font-Names="Arial" ForeColor="Purple"></asp:Label></td>
</tr>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ThreadID" AllowPaging="True" BorderColor="#f10383" BorderWidth="1px" GridLines="Horizontal" HorizontalAlign="Center" Width="700px">
<Columns>
<asp:ButtonField CommandName="Select" HeaderText="Subject" ShowHeader="True" Text="View Messages" DataTextField="Subject" />
<asp:BoundField DataField="Username" HeaderText="Author" />
<asp:BoundField DataField="Replies" HeaderText="Replies" />
<asp:BoundField DataField="LastPostDate" HeaderText="Original Post" ApplyFormatInEditMode="True" DataFormatString="{0:d}" HTMLEncode=False>
<ItemStyle HorizontalAlign="Right" Width="100px" />
</asp:BoundField>
</Columns>
<HeaderStyle BackColor="#F10380" Font-Bold="True" Font-Names="Arial" Font-Size="12pt" ForeColor="White" HorizontalAlign="Left" VerticalAlign="Top" />
<AlternatingRowStyle BackColor="Honeydew" />
</asp:GridView>
</td>
</tr>
<tr>
<td>
<table align="center" width="700">
<tr>
<td>
<table style="border-right: #f10383 1px solid; border-top: #f10383 1px solid; border-left: #f10383 1px solid; border-bottom: #f10383 1px solid" width="300" cellpadding="0" cellspacing="0">
<tr>
<td style="font-weight: bold; font-size: 12pt; width: 480px; color: white; font-family: Arial; background-color: #f10380">
&nbsp;Start a new thread</td>
</tr>
<tr>
<td style="width: 480px; height: 39px">
&nbsp;Subject:&nbsp;
<asp:TextBox ID="TextBox1" runat="server" Width="327px" MaxLength="190"></asp:TextBox></td>
</tr>
<tr>
<td align="center" style="width: 480px">
<asp:Button ID="Button1" runat="server" Text="Start Thread" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
[b]
[b]
&nbsp;[b]
[b]
[b]
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder2">
<asp:Label ID="lblGroupName" runat="server" Text="Label" ForeColor="White"></asp:Label>[b]
</asp:Content>
<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolder3">
<asp:Menu ID="Menu2" runat="server" DynamicHorizontalOffset="10" Font-Bold="True" Font-Names="Arial" Font-Size="12pt" ForeColor="#0000C0" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False" Visible="False">
<DynamicHoverStyle ForeColor="Lime" />
<DynamicMenuStyle BackColor="#F10380" Height="50px" HorizontalPadding="3px" VerticalPadding="3px" />
<DynamicMenuItemStyle Font-Size="10pt" />
<Items>
<asp:MenuItem NavigateUrl="~/groupadmin.aspx" Text="Admin" Value="Logout"></asp:MenuItem>
</Items>
<StaticHoverStyle ForeColor="#F10383" />
</asp:Menu>
</asp:Content>
<asp:Content ID="Content4" runat="server" ContentPlaceHolderID="ContentPlaceHolder4">
<asp:Label ID="Label4" runat="server" Font-Size="12pt" Text="Label"></asp:Label></asp:Content>