以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]页面网格的标题发送到服务器 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=178328) |
-- 作者:2425004926 -- 发布时间:2022/6/30 9:32:00 -- [求助]页面网格的标题发送到服务器 在下面的页面中,如果点击了某个网格,我想把这个网格的标题发送到服务器,因为在链接的网页中要用到这个标题,怎么解决,老师指点一下 Select Case e.PathCase "test.htm" Dim wb As New WeUI wb.AddPageTitle("","pageheader","WeUI","微信网页设计样式库") With wb.AddGrid("","g1") .Add("c1","Button", "./images/button.png").Attribute = "" .Add("c2","Cell", "./images/cell.png", "http://www.foxtable.com") .Add("c3","Toast", "./images/toast.png", "http://www.foxtable.com") .Add("c4","Dialog", "./images/dialog.png", "http://www.foxtable.com") .Add("c5","Progress", "./images/progress.png", "http://www.foxtable.com") .Add("c6","Msg", "./images/msg.png", "http://www.foxtable.com") .Add("c7","Article", "./images/article.png", "http://www.foxtable.com") .Add("c8","ActionSheet", "./images/actionSheet.png", "http://www.foxtable.com") .Add("c9","Icons", "./images/icons.png", "http://www.foxtable.com") .Add("c10","Panel", "./images/panel.png", "http://www.foxtable.com") .Add("c11","Tab", "./images/tab.png", "http://www.foxtable.com") .Add("c12","SearchBar", "./images/search.png", "http://www.foxtable.com") End With e.WriteString(wb.Build) End Select |
-- 作者:有点蓝 -- 发布时间:2022/6/30 9:34:00 -- .Add("c2","Cell", "./images/cell.png", "http://www.foxtable.com?title=标题1") .Add("c3","Toast", "./images/toast.png", "http://www.foxtable.com?title=标题2") 通过参数传输,服务端通过e.getvalues获取
|
-- 作者:2425004926 -- 发布时间:2022/6/30 10:17:00 -- 提示:从字符串“认知”到类型“Integer”的转换无效。这个字符串要加引号吗? Case "test.htm" .Add("c2", "认知", "./images/cell.png", "List.htm?title=认知&page=0") Case "list.htm" Dim title As String \'接收网址传来的数据
If e.GetValues.ContainsKey("title") Then \'如果地址中有标题参数 Integer.TryParse(e.GetValues("title"), title) \'提取标题参数 End If |
-- 作者:有点蓝 -- 发布时间:2022/6/30 10:20:00 -- 字符串直接用就行,干嘛要转换为整数?!!! |
-- 作者:2425004926 -- 发布时间:2022/6/30 10:29:00 -- 是运行错误提示:从字符串“认知”到类型“Integer”的转换无效 |
-- 作者:有点蓝 -- 发布时间:2022/6/30 10:30:00 -- 为什么要转换为整数?!!!去掉转换的代码 |
-- 作者:2425004926 -- 发布时间:2022/6/30 10:32:00 -- 是因为字符串定义时设置了初始值,取掉初始值,好了,谢谢老师 |
-- 作者:2425004926 -- 发布时间:2022/6/30 12:05:00 -- 老题帮忙再看一下,由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 |
-- 作者:有点蓝 -- 发布时间:2022/6/30 12:13:00 -- .Add("btnPrev", "上一页", "", "List.htm?title=" & title & "&page=" & page - 1) .Add("btnNext", "下一页", "", "List.htm?title=" & title & "&page=" & page + 1) |
-- 作者:2425004926 -- 发布时间:2022/6/30 12:20:00 -- 谢谢老师!编程真是个技术活,所有劳动就是个苦劳,小细节好了,运行没问题才能算功劳 |