We use custom a derived GridView and ObjectDataSource control for custom binding, paging, and sorting. While it's working correctly under 3.5 testing under 4.0 shows button commands are not working properly. Included is an eample which I've distilled as
much as possible.
In the example hit Bind Grid for the initial binding, then click 'Next' to advance the page.
In VS 2010 RC when Targetting framework 3.5 everything works as expected.
In VS 2010 RC when Targetting framework 4.0, clicking 'Next' one time works as expected. Clicking 'Next' again fails to raise a paging command.
Thanks for looking at this. For some reason the forum doesn't like some instances of SortExpression but allowed others. Send me an email and I'll be happy to send a zip file with the working example solution.
None
0 Points
12 Posts
Derived GridView button commands only fire once in 4.0
Feb 16, 2010 11:11 AM|dbrink|LINK
We use custom a derived GridView and ObjectDataSource control for custom binding, paging, and sorting. While it's working correctly under 3.5 testing under 4.0 shows button commands are not working properly. Included is an eample which I've distilled as much as possible.
In the example hit Bind Grid for the initial binding, then click 'Next' to advance the page.
In VS 2010 RC when Targetting framework 3.5 everything works as expected.
In VS 2010 RC when Targetting framework 4.0, clicking 'Next' one time works as expected. Clicking 'Next' again fails to raise a paging command.
<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="Test.aspx.cs" Inherits="Example.TestPage" %>
<%@ Register Assembly="WebApplication1" Namespace="Example" TagPrefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="btnBind" runat="server" Text="Bind Grid" OnClick="btnBind_Click" />
<c:GridView ID="gridView" runat="server"
AutoGenerateColumns="false"
DataKeyNames="Id"
OnPageIndexChanging="gridView_PageIndexChanging"
OnSorting="gridView_Sorting"
AllowPaging="true"
AllowSorting="true"
EnableSortingAndPagingCallbacks="false"
>
<Columns>
<asp:BoundField HeaderText="Last" DataField="LastName" SortExpression="LastName" />
<asp:BoundField HeaderText="First" DataField="FirstName" SortExpression="FirstName" />
</Columns>
<EmptyDataTemplate>No data</EmptyDataTemplate>
<PagerTemplate>
<asp:LinkButton ID="btnPrevious" runat="server" CommandName="Page" CommandArgument="Prev" Text="Previous" ValidationGroup="search" />
<asp:LinkButton id="btnNext" runat="server" CommandName="Page" CommandArgument="Next" Text="Next" ValidationGroup="search" />
</PagerTemplate>
</c:GridView>
<c:ObjectDataSource ID="dataSource" runat="server"
TypeName="Example.Person"
DataObjectTypeName="Example.Person"
EnableCaching="false"
DeleteMethod="Delete"
InsertMethod="Insert"
UpdateMethod="Update"
SelectMethod="GetPeople"
EnablePaging="true"
SortParameterName ="sort"
StartRowIndexParameterName="row"
MaximumRowsParameterName="rows"
>
</c:ObjectDataSource>
</div>
</form>
</body>
</html>
Member
520 Points
304 Posts
Re: Derived GridView button commands only fire once in 4.0
Feb 16, 2010 03:31 PM|Radomir|LINK
Thanks for reporting this. We will investigate this issue.
PS. Thanks for posting full code required for repro, as it speeds up investigation.
None
0 Points
12 Posts
Re: Derived GridView button commands only fire once in 4.0
Feb 16, 2010 08:39 PM|dbrink|LINK
Thanks for looking at this. For some reason the forum doesn't like some instances of SortExpression but allowed others. Send me an email and I'll be happy to send a zip file with the working example solution.