老题帮忙再看一下,由test.htm到list.htm第一页没有问题,经测试下一页时page显示0,title为空,按钮的红色部分用了变量,这里是否不能用变量?
Select Case e.Path
Case "test.htm"
Dim wb As New WeUI
wb.AddPageTitle("", "pageheader", "张策", "")
With wb.AddGrid("", "g1")
.Add("c10", "太极拳", "./images/panel.png", "List.htm?title=太极拳&page=0")
.Add("c11", "通背拳", "./images/tab.png", "List.htm?title=通背拳&page=0")
.Add("c12", "合气道", "./images/search.png", "List.htm?title=合气道&page=0")
End With
e.WriteString(wb.Build)
Case "list.htm"
Dim page As Integer = 0 '默认page为0,显示第一页
Dim title As String
title = e.GetValues("title")
'----------------------------------------------------------
'接收网址传来的数据
If e.GetValues.ContainsKey("page") Then '如果地址中有page参数
Integer.TryParse(e.GetValues("page"), page) '提取page参数,转化为数值
End If
MessageBox.Show(page) '第一页显示没有问题,下一页时这个值就为0 MessageBox.Show(title) '第一页显示没有问题,下一页时这个值就为空 '----------------------------------------------------------
'计算出总页数
Dim lst As List(Of DataRow) = DataTables("zhangce").select("类别 = '" & title & "'")
Dim Pages As Integer = lst.Count - 1
'----------------------------------------------------------
'根据此页数据生成显示内容
Dim wb As New weui
wb.AddPage("", "page")
'----------------------------------------------------------
Dim xt1, xt2 As String
If lst(page).isnull("二类") Then
xt1 = lst(page)("名词")
Else
xt1 = lst(page)("二类") & "--" & lst(page)("名词")
End If
xt2 = lst(page)("说明")
'----------------------------------------------------------
With wb.AddArticle("page", "ar1")
.AddTitle("h3", "<p>" & xt1 & "</p>") 'h1字号最大,h6最小
.AddContent("<p>" & xt2 & "</p>")
End With
'----------------------------------------------------------
'生成换页按钮
With wb.AddButtonGroup("", "btg1", False)
.Add("btnNext", "首页", "", "test.htm")
If page = 0 Then
.Add("mnuFirst", "第一页").Enabled = False '此项不可选
.Add("mnuLast", "最末页", "", "List.htm?title=" & title & "page=" & pages - 1)
.Add("btnPrev", "上一页").Enabled = False '此项不可选
.Add("btnNext", "下一页", "", "List.htm?title=合气道&page=" & page + 1)
‘如果换成"List.htm?title=合气道&page=" & page + 1则没有问题 ElseIf page = pages Then
.Add("mnuFirst", "第一页", "", "List.htm?title=" & title & "page=0")
.Add("mnuLast", "最末页").Enabled = False '此项不可选
.Add("btnPrev", "上一页", "", "List.htm?
title=" & title & "page=" & page - 1)
.Add("btnNext", "下一页").Enabled = False '此项不可选
Else
.Add("mnuFirst", "第一页", "", "List.htm?
title=" & title & "page=0")
.Add("mnuLast", "最末页", "", "List.htm?title=" & title & "page=" & pages - 1)
.Add("btnPrev", "上一页", "", "List.htm?title=" & title & "page=" & page - 1)
.Add("btnNext", "下一页", "", "List.htm?title=" & title & "page=" & page + 1)
End If
End With
e.WriteString(wb.Build) '生成网页
End Select