THESE FORUMS ARE NOW FROZEN
Please choose "Forums" from the Main menu of www.entityspaces.net to get to our new forums.

esDataSource + Gridview + Autosorting problem

rated by 0 users
This post has 8 Replies | 1 Follower

Top 10 Contributor
Posts 172
rotep Posted: 03-23-2009 4:51 AM

Hi,

i've setup an esDataSource with Gridview. I've set Autopaging and Autosorting to true on both the datasource and the gridview. I receive the following error:

ORA-30485: missing ORDER BY expression in the window specification

If I set Autopaging to false, it does work. So my guess is something is going wrong with Autopaging?

Code:
Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim vo As New BLL.ViewPnm
            vo.Query.es.CountAll = True
            vo.Query.es.CountAllAlias = "Count"
            If vo.Query.Load() Then
                Me.EsDataSource1.TotalRowCount = vo.GetColumn("Count")
            End If
        End If
    End Sub

    Private Sub EsDataSource1_esSelect(ByVal sender As Object, ByVal e As EntitySpaces.Web.esDataSourceSelectEventArgs) Handles EsDataSource1.esSelect
        Dim coll As New BLL.ViewPnmCollection
        e.Collection = coll
    End Sub
End Class
Top 10 Contributor
Posts 905
What version of EntitySpaces are you using? In EntitySpaces 2009 you shouldn't need to set the count in load so you can remove all that code, and we should have a check in for no sort order. 

Regards, Scott Schecter EntitySpaces | Blog | Twitter

Top 10 Contributor
Posts 172

We have the 2009 version installed. But for some quick (how ironic, the entire workflow is faster with the older mygeneration + es solution riiiiight? :-P) solutions i'm still working with 2008.1.927.0

Anyway, paging should work even in the older release..? I don't want to be an annoying customer or anything, just let me know if it's harder for you to check what i'm doing wrong than it is for me to start using 2009...

Top 10 Contributor
Posts 905
It should work in either yes, I'm not sure off the top of my head when we added the check for sort order, so as a workaround you can set it in the esSelect event if not set. I will find you an example here in just a bit. I am getting ready to head out the door.

Regards, Scott Schecter EntitySpaces | Blog | Twitter

Top 10 Contributor
Posts 172

I've added: query.OrderBy(query.Pn.Ascending) in the esSelect event. This does solve the Oracle error. But the gridview only shows the first-page-records, on every page.

Also, hard-coding the sort breaks the gridview sort right?

Top 10 Contributor
Posts 905
You need to check the esDataSource args e.SortItems and only set the order by if it is null in esSelect.

Regards, Scott Schecter EntitySpaces | Blog | Twitter

Top 10 Contributor
Posts 905
Code:
if (e.SortItems == null)
{
	employees.Query.OrderBy(employees.Query.EmployeeID.Ascending);
}

Regards, Scott Schecter EntitySpaces | Blog | Twitter

Top 10 Contributor
Posts 3,881
An OrderBy statement is required in All paging systems that databases implement. This is not an ES requirement, in order to page there has to be some order. So, that entire first part is not really an error, you have to have that per the DBMS system. So what you're now saying is you only see the first page over and over again?

EntitySpaces | Twitter | BLOG | Please honor our Software License

Top 10 Contributor
Posts 172

I understand that there needs to be some order. However my solution hard-coded the sortorder, no matter which headercell you click. This probably was the root of the error (not error, but every page showing the same data).

Anyway, Scott's solution works.. Thanks!

Page 1 of 1 (9 items) | RSS
Copyright © 2005 - 2009, EntitySpaces, LLC