Dim fl As String = "d:\web\" & e.path
If filesys.FileExists(fl)
Dim idx As Integer = fl.LastIndexOf(".")
Dim ext As String = fl.SubString(idx)
Select Case ext
Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
e.WriteFile(fl)
Return '这里必须返回
End Select
End If
Select Case e.Path
Case "addnew.htm"
Dim wb As New weui
If E.PostValues.Count = 0 Then
wb.AddForm("","form1","ADDNEW.htm")
With wb.AddInputGroup("form1","ipg1","录入")
.AddInput("物料编码","物料编码","text")
.AddInput("申购数量","申购数量","number")
.AddInput("到货日期","到货日期","date")
End With
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1", "增加明细", "submit").Value = "btn1"
.Add("btn2", "上传数据", "submit").Value = "btn1"
.Add("btn3", "取消", "reset")
End With
With wb.AddTable("form1","Table1")
.head.AddRow("物料编码","申购数量","到货日期") '表头
.body.AddRow("AAA",111,#12/01/2008#)
.body.AddRow("BBB",222,#12/02/2008#)
.body.AddRow("CCC",333,#12/03/2008#)
End With
e.WriteString(wb.Build) '生成网页
Else
Dim nms() As String = {"物料编码","申购数量","到货日期"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1","返回").Attribute = ""
End With
e.WriteString(wb.Build)
Return '必须返回
End If
Next
If e.PostValues.ContainsKey("btn1") Then
'------想把这段代码改为在页面表格中新增一行数据-------------
Dim dr As DataRow = DataTables("表A").AddNew()
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr(nm) = e.PostValues(nm)
End If
Next
'------想把这段代码改为在页面表格中新增一行数据-------------
With wb.AddMsgPage("","增加成功","增加成功","新增明细成功")
.AddButton("btn1","继续增加","addnew.htm")
End With
e.WriteString(wb.Build)
ElseIf e.PostValues.ContainsKey("btn2") Then
'------想把页面表格的数据上传到服务器中,然后清空页面的表格,代码应如何写?-------------
With wb.AddMsgPage("","提交成功","提交成功","数据已提交到服务器中")
.AddButton("btn1","确认","addnew.htm")
End With
e.WriteString(wb.Build)
End If
End If
End Select