Developer forum

Forum » Templates » 2 DataLists and Sortby

2 DataLists and Sortby

Marco Johannesen
Reply
Hello,

I have two datalists on one page.
One creates a list of filtering options, the other a data tabla.

I would like to have sorting on the the data table, but when adding the sorting function, it tries to sortby on both datalists, and since the row its sorting by isn't in the filtering datalist it fails with an error.

Is it possible to ONLY make sorting avaible on one?

(the "Sortable headers" option only seems to affect the link output in the datalist - not disabling it from being executed in the SQL)

ERROR:
An error occured while attaching module (Dynamicweb.Frontend.Content)

System.IndexOutOfRangeException: Cannot find column AccessUserZip.


Replies

 
David Matheson
Reply

Hi Marco

The problem probably lies in that AccessUserZip is not present in both datalists - but without access to your solution it is difficult to say for sure.
 
Suggest you use an If statement that checks for a Server:Request.variable in the sort order.  If it exists then exclude datalist 1 from showing, if not exist then exclude datalist 2 from showing and vice versa.  Then you should avoid the error message.

Hope this helps
David

 
Marco Johannesen
Reply
The problem is
DATALIST1 : Filtering options from the DB
DATALIST2 : Datalist based on the filtering options

So i can't really remove the filtering options if the user tries to sort the datalist :(

Regards
Marco

 

You must be logged in to post in the forum