locked
Sorting by column header click doesn't work RRS feed

  • Question

  • User1659723493 posted
    Hello I am using EntityDataSource for my Data Model. This DataSource connects with postgreSQL database using dotConnect drivers. Everything works fine except sorting my tables. I've tried to create a simple mode with MSSQL database (two columns from northwind database) and it works fine. Then I did similarly to test this with postgres database (I've chosen three simple tables). The problem is that when using data from postgreSQL for my dynamic data site sorting by column header click is not working. Could you give me an advice where should I look for solving this problem? thank you in advance
    Thursday, December 11, 2008 4:21 AM

All replies

  • User-330204900 posted

    Hi Jacekskowron, I think your issue is with the postgreSQL ADO.Net Editites provider I'd have a go creating a command line app with one table and do a comparison again SQL Server and then if you are able to isolate the issue to say the Linq orderby statment then post you results to the Entity Framework forum here: ADO.NET Entity Framework and LINQ to Entities (Pre-release) - MSDN ...

    Hope this helps [:D]

    Thursday, December 11, 2008 5:50 AM
  • User1659723493 posted
    Hi Stephen,
    I've done few experiments and here are results.

    1) There is no difference in linq order expression.
    2) Both providers sort Entities as var query = edm.Table.OrderBy(e=> e.ColumnName)
    3) Both sort data in grid when on a single page there is only GridView and EntityDataSource set to some table from EntityDataModel

    4) But only for mssql sorts data when put into dynamic data List page template, even if called Sort("columnName", direction) programmatically in GridViewRowCommand.

    So I have no idea what can cause this problem.
    Thursday, December 11, 2008 8:37 AM
  • User-330204900 posted

    Hi Jacekskowron, So what you are saying it that only in the List.aspx PageTemplate does sort fail for postgreSQL?

    If that's thae case hopefully one the team will have alook at this and may be point you in the right direction.

    Thursday, December 11, 2008 12:33 PM
  • User-1005219520 posted

    >>  There is no difference in linq order expression.

    That's what I would expect. The generated LINQ is identical. It's up to the provider to implement the OrderBy clause.  You could use SQL profiling to see what is sent to the DB and compare it to the profiling of your provider.

    Thursday, December 11, 2008 12:36 PM
  • User1659723493 posted
    Here is generated SQL, captured by DBMonitor:
    1) For table where sorting works fine (only standard gridView and entity data source wired to specific table):
    SELECT
    "Extent1"."name" AS "name",
    "Extent1".description AS description,
    "Extent1".expires AS expires,
    "Extent1".fullname AS fullname,
    "Extent1".kanal AS kanal,
    "Extent1".validatephotos AS validatephotos,
    "Extent1".weekday_begin AS weekday_begin,
    "Extent1".optlock AS optlock
    FROM portal.products AS "Extent1"
    ORDER BY "Extent1".description ASC

    orderby column changes as I sort GridView.

    2) When used with Dynamic Data:
    SELECT
    c."name" AS "name",
    c.description AS description,
    c.expires AS expires,
    c.fullname AS fullname,
    c.kanal AS kanal,
    c.validatephotos AS validatephotos,
    c.weekday_begin AS weekday_begin,
    c.optlock AS optlock
    FROM portal.products AS c LIMIT 10 OFFSET 0

    So there is no ORDER BY clause no matter if it is first table viewing or it is querry requested by sorting.
    Friday, December 12, 2008 2:02 AM
  • User1659723493 posted
    Does anyone know what can cause my problem? Maybe it's not provider error if sorting works fine when used without dynamic data?
    Monday, December 15, 2008 9:10 AM
  • User660823006 posted

    So are you saying that if you just use the an EntityDataSource and a GridView in a standard page it works fine but if you use a Dynamic Data page it does not work correctly?

    Tuesday, December 16, 2008 3:21 AM
  • User1659723493 posted
    Yes. That's right.
    Tuesday, December 16, 2008 7:31 AM
  • User-1005219520 posted

    I've been looking for a postgreSQL database to debug this issue but can't find one. How would I got about gettng access to a postgreSQL database?

    Tuesday, December 16, 2008 12:37 PM
  • User1659723493 posted
    Hi.
    Here you can download database:
    http://www.enterprisedb.com/products/pgdownload.do

    I've created a simple database and project, where I included my tests.
    Here is sql script to create my DataBase:
    http://skowroneczek.republika.pl/pgTest/dbScript.sql
    and here is my test project.
    http://skowroneczek.republika.pl/pgTest/PostgreDynamicData.rar
    Wednesday, December 17, 2008 4:36 AM