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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DWMX2004 and ASP/VB - Need a Sort by Name dropdown through Repeat Regi

Status
Not open for further replies.

slakker

MIS
Jun 5, 2003
59
US
Hi all..
I've created an ASP/VB page completely with DWMX2004, very minimal code tweaking, using mostly the tools available in DW.

Created a Table with a bunch of columns pulling info from MS Access DB, and set a Repeat Region on that table..
I also have Add/Update/Delete pages, etc..

I've been trying to figure out how to add a dropdown box (or maybe several) to Sort on various columns..

like above the Name column, i'd like to be able to sort by Name.. then Zipcode, State, etc..

Maybe if I could Sort the table by clicking on the column Headings, that would be even better..

I have a table with 3 rows and 5 colums.. top row is where my column Headings are.. then a spacer row, and then the info pulled from DB.. i've set the repeat region just on the bottom Row..

So, any ideas would be appreciated it.
Thanks in advance! :)
 
Column headings could have a link to the same page with a querystring attached. Then your recordset would sort on a passed url value. The several dropdown would be similar, a form passing variables to the same page and your recordset sorting on the passed variables.

Cheech

[Peace][Pipe]
 
Yes, that sounds like what I want..

Any example of this please?
 
Column Heading - Add this to the head of your display page
<%
If Request.Querystring(&quot;sort&quot;) <> &quot;&quot; Then
strSort = Request.Querystring(&quot;sort&quot;)
Else
strSort = &quot;defaultsortColumn&quot;
%>

The source line in your Recordset will need changing to

rsYourRS.Source = &quot;SELECT * FROM yourTable WHERE yourSelectionCriterea ORDER BY &quot; & strSort
your column headings would just have a normal link added so the link looks like

<a href=&quot;yourPage.asp?sort=fldOne&quot;>One</a>


Multi sorts are similar but just grab the data from a form and build the strSort from passed variables.

<%
if request.form(&quot;sort1&quot;).value <> &quot;&quot; then
strSort=request.form(&quot;sort1&quot;).value
end if
if request.form(&quot;sort2&quot;).value <> &quot;&quot; then
strSort=strSort & &quot;, &quot; & request.form(&quot;sort1&quot;).value
end if
%>

repeat the process for each select you have and use the same sql select statement.

Cheech

[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top