ASP .NET - SQL Dropping a customer to the bottom of a datagrid when clicked on.

Posted on 2007-10-02
Last Modified: 2008-01-09
I am listing contractors on a web site using SQL scripting sorting by clicks.

When someone clicks on a contractor from the list their position drops down to the bottom, then as other contractors are clicked they get pushed down to the bottom and the other one gets to go one up.

Here a thought:
Since the list will never be more than 500 I use this SQL script:
UPDATE Customers SET clicks = clicks + 500 WHERE (CusID =  [indoogrid:idValue])

 and of course sort by clicks when displaying list.

but how do the others go up in proper order  ...

say I have 50 set to 500 sorted by Clicks....  How will the first contractor clicked remain 50 from the bottom ?

is there a solution to this ?
Question by:siacom
    1 Comment
    LVL 2

    Accepted Solution

    what about instead of sorting by a arbitrary "click" value, add a datetime field called "ClickDate".  when you click on a contractor, set  that items "ClickDate" value to getDate(). then just sort the list by "ClickDate".

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now