日期:2014-05-17  浏览次数:20893 次

ASP怎样可以按指定的内容来进行分页显示?
大家好,请问ASP怎样可以按指定的内容来进行分页显示?
如:有一个表teachingplan,表中有ID(自动编号),teachingSubject(有:语文、音乐两个学科),text(这是内容)三个字段;有一个下拉列表(单击可以选择相应的学科,如:语文、音乐)。
对它们进行分页显示,但就把整个表的内容进行了分页,我想单击下拉列表的音乐,那么它只能对表中的音乐学科的内容进行分页,而不是整个表的内容来分页,请问怎样写代码?


------解决方案--------------------
<select name= "Subtype " onChange= "location.href= '?subtype= '+this.Options[this.SelectedIndex].value ">
<option value= "请选择 "> 请选择 </option>
<option value= "音乐 "> 音乐 </option>
<option value= "语文 "> 语文 </option> (也可以直接从数据库中掉,注意用distinct避免重复)

然后就可以获取值了
Dim SubType
SubType=Reuqest.QueryString( "subType ")
SQL= "select * from [teachingplan] where teachingSubject= ' "&SubType& " ' "
下面执行Sql语句分页显示结果就不用写了吧..............
------解决方案--------------------
分页的东西 好象不少地方讨论嘛~
一般对所有内容分页就是直接 ***.asp?page=1
对指定内容分页无非就是***.asp?page=1&type=**

给你一个我以前常用的分页代码~
:分页函数~
sub showpage(fl,sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= " <table align= 'center '> <tr> <td class= 'pw '> "
if ShowTotal=true then
strTemp=strTemp & "共 <b> " & totalnumber & " </b> " & strUnit & "&nbsp;&nbsp; "
end if
strUrl=JoinChar(sfilename)
if CurrentPage <2 then
strTemp=strTemp & "首页 上一页&nbsp; "
else
strTemp=strTemp & " <a href= ' " & strUrl & "page=1&fcategoryid= "&fl& " ' class= 'lb '> 首页 </a> &nbsp; "
strTemp=strTemp & " <a href= ' " & strUrl & "page= " & (CurrentPage-1) & "&fcategoryid= "&fl& " ' class= 'lb '> 上一页 </a> &nbsp; "
end if

if n-currentpage <1 then
strTemp=strTemp & "下一页 尾页 "
else
strTemp=strTemp & " <a href= ' " & strUrl & "page= " & (CurrentPage+1) & " &fcategoryid= "&fl& " ' class= 'lb '> 下一页 </a> &nbsp; "
strTemp=strTemp & " <a href= ' " & strUrl & "page= " & n & "&fcategoryid= "&fl& " ' class= 'lb '> 尾页 </a> "
end if
strTemp=strTemp & "&nbsp;页次: <strong> <font color=red> " & CurrentPage & " </font> / " & n & " </strong> 页 "
strTemp=strTemp & "&nbsp; <b> " & maxperpage & " </b> " & strUnit & "/页 "
if ShowAllPages=True then
strTemp=strTemp & "&nbsp;转到: <select name= 'page ' size= '1 ' onchange= " "javascript:window.location= ' " & strUrl & "fcategoryid= "&fl& "&page= " & " '+this.options[this.selectedIndex].value; " "> "
for i = 1 to n
strTemp=strTemp & " <option value= ' " & i & " ' "
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selecte