📄 dropdown_explain.aspx
字号:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<HTML>
<script language="VB" runat="server">
Public DDLColumn(10) as string
Public CodeField(10) as string
Public DisplayField(10) as string
Public DDLSql(10) as string
Public s as String
Sub page_load(sender As Object, e As EventArgs)
ParseDropDown
end sub
Sub set1_Click(Sender As Object, E As EventArgs)
Dim i as integer
i = GetDDLindex("1")
s= "DDLColumn = " + DDLColumn(i)
s = s + " CodeField=" +CodeField(i)
s = s + " DisplayField=" +DisplayField(i)
s = s + " DDLSQL=" +DDLSQL(i)
response.write(s)
End Sub
Sub set2_Click(Sender As Object, E As EventArgs)
Dim i as integer
i = GetDDLindex("a")
s= "DDLColumn = " +DDLColumn(i)
s = s + " CodeField=" +CodeField(i)
s = s + " DisplayField=" +DisplayField(i)
s = s + " DDLSQL=" +DDLSQL(i)
response.write(s)
End Sub
Sub set3_Click(Sender As Object, E As EventArgs)
Dim i as integer
i = GetDDLindex("p")
s= "DDLColumn = " +DDLColumn(i)
s = s + " CodeField=" +CodeField(i)
s = s + " DisplayField=" +DisplayField(i)
s = s + " DDLSQL=" +DDLSQL(i)
response.write(s)
End Sub
Function GetDDLIndex(vDDLColumn as string) as integer
'Pass in the column where a drop down list must apper
' this function returns the row where its details are
' stored in the array
Dim i as integer, vKey as integer
For i= 0 to UBound(DDlColumn)
If DDlColumn(i) = vDDLColumn
vKey = i
End if
Next
Return vKey
End Function
Function ParseDropDown()
Dim strChar As Object
Dim s As String
Dim j As Integer
Dim count As Integer
Dim idx as integer
count = 1
idx = 0
strChar = Split("1;2;3;4;a;b;c;d;p;q;r;s;", ";")
For j = 0 To UBound(strChar)
If Len(strChar(j)) = 0 Then
Else
s = CStr(strChar(j))
If count = 1 then
DDLColumn(idx) = s
Elseif count = 2 then
CodeField(idx) = s
elseif count = 3 then
DisplayField(idx) = s
elseif count = 4 then
DDLSql(idx) = s
count = 0
idx = idx + 1
End if
count = count + 1
End If
Next
End Function
</script>
<form runat = "server" >
<BODY>
<asp:button text="Set1(1;2;3;4)" Onclick="set1_Click" runat=server/>
<asp:button text="Set2(a;b;c;d)" Onclick="set2_Click" runat=server/>
<asp:button text="Set3(p;q;r;s)" Onclick="set3_Click" runat=server/>
</form>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -