Developer forum
E-mail notifications
Data List module not showing right Detail URL
This site is working fine.
Then go to http://www.cphvision.dk/Exhibitors/Brands.aspx?Purge=True&Fair=480
The list here is fine, but in the URL on the list-items something is missing. I think AccessUserID is being left out, but I can't figure out why.
Please help :-)
Replies
Did you select thatAccessUserId or other columns in the selected field list for the details page?
Cheers,
Imar
Is your Data List set up correctly? What happens when you use the SQL of the list that does work?
Imar
Hi,
DataList module uses table’s primary key. If your SQL simple and looks like
“SELECT [AccessUserID], [AccessUserName] FROM [AccessUser] WHERE AccessUserID IN (274, 275)”,
it’s OK, you will receive 2 unique rows, the module will be able to use AccessUserID as primary key and generate valid details link.
Try to use another SQL (I’ve created this example based on your “Brandlist” data list):
“SELECT [AccessUserID], [AccessUserName] FROM [AccessUser] WHERE AccessUserID IN (274, 275)
UNION ALL
SELECT [AccessUserID], [AccessUserName] FROM [AccessUser] WHERE AccessUserID IN (274, 275)”
In this case we will receive 4 rows and AccessUserID will be duplicated twice. The module can’t use the field as primary key and generate valid details link. The module can’t detect what field is primary.
Solution. If you need valid details link, always track what a Datalist SQL statement returns.
We need to get the right URL somehow, so have you got other suggestions?
Not sure if it helps, but it's worth a try...
Regards,
Imar
I fixed it by printing out the AccessUsedId field as a column along with the two other columns in my output. Then I made a javascript that took the first value of each row (The AccessUserId) and generated a link for the two other rows based on this Id (Which was the only thing I was missing in the link).
This solution is not really elegant, since it uses javascript, but it works!
And ofcourse I used CSS to hide the AccessUserId that i printed out as a column, since it's not needed for anything except generating a valid DetailUrl.
See it in action here: http://www.cphvision.dk/Exhibitors/Brands.aspx?Purge=True
As solution you can create 10 data lists with simple SQL queries, than add them to the page.
Yeah, well that would work in regards to the DetailURL. Unfortunately I can't really see any good way of sorting the list, if it is generated by 10 separate quieries.
Anyway, the client is happy with the javascript fix, so we'll leave at at that for now.
You must be logged in to post in the forum