ASP数据岛操作类(10)
'=============================
'实现列表排序
'返回Url参数并动态改变排序方式
'参数:需要进行排序的字段名,显示的名称
'=============================
Private Function Sort(SortStr,DispName)
If SortStr = "" Or DispName="" Then Exit Function
Sort = GetUrl("SOrder,SSort")
SSort = UCase(Request.QueryString("SSort"))
If SSort = "DESC" Then
SSort = "ASC"
Else
SSort = "DESC"
End If
Sort = "<a class='headhref' href='"&Sort&"SOrder="&SortStr&"&SSort="&SSort&"'>"&DispName&SortType(SortStr)&"</a>"
End Function
'-----------------------------------------------
'标识排序列为升序还是降序方式
'参数:排序列字段名称
'-----------------------------------------------
Private Function SortType(FieldName)
Dim SOrderName
SOrderName = Request.QueryString("SOrder")
If SOrderName<>FieldName Then Exit Function
Dim SSortImg
SSortImg = Request.QueryString("SSort")
SortType = "<img src='/OrderFormSystem/images/"&SSortImg&".gif' border='0'>"
End Function
End Class
'users Like { UserID,LoginName,Password,RealName,Age,Gender,}
'initDB
Rs.Open "Select * from users",Cn
Dim tbGrid1
Set tbGrid1 = New TBGrid
Set tbGrid1.DataSource = Rs
tbGrid1.Columns.add "LoginName","用户名"
tbGrid1.HeadSort.add "LoginName",True
tbGrid1.Columns.add "Password","密码"
tbGrid1.AddTemplate "修改","<a href='aaa.asp?id={UserID}'><font color=red>{RealName}</font></a>"
tbGrid1.ItemStyle.add "Password","align=right"
内容版权声明:除非注明,否则皆为本站原创文章。