Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order by Button to oredr a table filled by criteria text boxes

Status
Not open for further replies.

delorfra

Programmer
Mar 8, 2001
79
FR
I have posted this in the Frontpage Forum without success

I have an ASP generated table with criteria text boxes.
1° I need to add buttons which orders the table by whatever columms.
2° I want to be able to click on any specific record in the table to open a page which will show more details.

How to go about it ?

Thanks
 
Well, the buttons that would order your table would need to reload the page (and the recordset that creates your table), send along a value that would indicate what column was clicked on, and then would add an ORDER BY clause to the end of your SQL Select statement that you retrieve your recordset with. You could then just output the recordset in exactly the same fashion as you do now, except now they will be ordered by the new criteria.

In order to make the clickable text in the table, the text would probably be a javascript function that would send some variables that would be meaningful about the text you clicked. The function would then open a pop-up window, using as it's url the url of the asp page that would display more details and probably have some querystring appended to the end of it (dictated by the variables that were sent to the javascript function)

ex)
Code:
<a href=&quot;javascript:doPopUp(2)&quot;>Click here for more info on number 2</a>

<!-- the javascript function -->
<script language=javascript>
  function doPopUp(value){
    urlString = &quot;somePage.asp?value=&quot; + value;
    window.open(urlString,'newWindow');
  }
</script>

Then, on the 'somePage.asp', you can look at the variable sent by the querystring to determine what values you need to pluck from the database in order to display more information on the originally clicked text...

Is that what you are looking for?

Let us know how it works out :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top