yasser777 / nettiers

Automatically exported from code.google.com/p/nettiers
0 stars 0 forks source link

Sorting bug in EntityGridView #358

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In asp.net web app, create a aspx page and add a entitygridview and a data 
source
2. Add columns to entitygridview with SortExpression attribute (one column 
should be nullable and have a few null values)
3. Run the site and use the grid's pager to view the records. 

What is the expected output? What do you see instead?
Expected to see proper pages values but insead some records are not displayed 
and some are displayed multiple times

What version of .netTiers and CodeSmith are you using?
.netiers build 263

Example aspx:
-------------
<%@ Page Language="C#" MasterPageFile="~/MasterPages/admin.master" 
AutoEventWireup="true" Inherits="User" Title="User List" 
CodeBehind="User.aspx.cs" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" 
runat="Server">User List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" 
runat="Server">
    <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="UserDataSource2"
        DataKeyNames="Id" AllowPaging="true">
        <Columns>
            <asp:BoundField DataField="CustomerId" SortExpression="[CustomerId]" HeaderText="CustomerId" NullDisplayText="NULL" />
            <asp:BoundField DataField="UserName" HeaderText="User Name" SortExpression="[UserName]" />
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="[Id]" />
        </Columns>
    </data:EntityGridView>
    <data:UserDataSource ID="UserDataSource2" runat="server" SelectMethod="GetPaged" />
</asp:Content>

Example aspx.vb
---------------
public partial class User : BL.BasePage
{   
    protected void Page_Load(object sender, EventArgs e)
    {
        FormUtil.RedirectAfterUpdate(GridView1, "User.aspx?page={0}");
        FormUtil.SetPageIndex(GridView1, "page");
        //FormUtil.SetDefaultButton((Button)GridViewSearchPanel1.FindControl("cmdSearch"));
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string urlParams = string.Format("Id={0}", GridView1.SelectedDataKey.Values[0]);
        Response.Redirect("UserEdit.aspx?" + urlParams, true);
    }
}

Example output (from a table with 19 rows and page size of 10)
--------------------------------------------------------------
Page 1 :
--------
CustomerId  User Name   Id(PK)
NULL        SM62461     70
NULL        nb51685     67
NULL        SS73947     63
NULL        DH48552     62
NULL        JW53991     61
NULL        LK69643     60
NULL        wh36166     58
NULL        mh50708     48
NULL        mk73642     47
NULL        rh48560     46

Page 2 :
--------
CustomerId  User Name   Id
NULL        JW53991     61
NULL        LK69643     60
NULL        wh36166     58
NULL        mh50708     48
NULL        mk73642     47
NULL        rh48560     46
NULL        graham      8
78      gra     80
82      gracom      79

[Note that first 6 rows are repeated in page 2 from page 1)

Actual Data in the DB
---------------------
CustomerId  User Name   Id(PK)
NULL        ccom        78
NULL        roasss      77
NULL        gc50630     76
NULL        df77220     75
NULL        gf12742     74
NULL        rs48587     73
NULL        SM62461     70
NULL        nb51685     67
NULL        SS73947     63
NULL        DH48552     62
NULL        JW53991     61
NULL        LK69643     60
NULL        wh36166     58
NULL        mh50708     48
NULL        mk73642     47
NULL        rh48560     46
NULL        graham      8
78      gra     80
82      gracom      79

--------------------------
Note that, for e.g., row ID 78,77 are not displayed in any page of the grid

Please provide any additional information below.
---------------------------------------------------------------
I tried to put a few breakpoints but I was not able to find the code causing 
the error

Original issue reported on code.google.com by vaibhavk...@gmail.com on 15 Dec 2010 at 10:24

GoogleCodeExporter commented 9 years ago
*correction : using .netTiers v2.3.0.863

Original comment by vaibhavk...@gmail.com on 15 Dec 2010 at 10:26

GoogleCodeExporter commented 9 years ago
Hello,

Can you please attach the sql script to create this table as well as some dummy 
records. It will really help reduce the time it takes to debug and reproduce 
this behavior.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 16 Dec 2010 at 9:04

GoogleCodeExporter commented 9 years ago
I have attached the relevant SQL. 

Original comment by vaibhavk...@gmail.com on 17 Dec 2010 at 7:01

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 29 Dec 2010 at 7:56

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, we changed our mind.  It was a pretty easy fix and it didn't cost SQL 
anything more than we were already using.

Fixed in 

Original comment by jmhin...@gmail.com on 29 Dec 2010 at 8:24

GoogleCodeExporter commented 9 years ago
Fixed in 867

Original comment by jmhin...@gmail.com on 29 Dec 2010 at 8:24

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 7 Jan 2011 at 2:44