有模式的窗口
function GetCustomerInfo(id)
{
showModalDialog('GetCustomers.aspx?id='+id,window,'help:no;status:no;resizable:yes;dialogWidth:580px;dialogHeight:400px');
}
Public C_strCon As String = ConfigurationSettings.AppSettings("ConnectionString")
Public ServerDir As String = ConfigurationSettings.AppSettings("ChongYuanDirServer")
Public strSql As String
Public Sub MsgBox(ByVal pMsg As String, ByVal oPage As Page)
Dim strScript As String = "<script language=JavaScript>"
strScript += "alert('" & pMsg & "');"
strScript += "</script>"
If (Not oPage.IsStartupScriptRegistered("clientScript")) Then
oPage.RegisterStartupScript("clientScript", strScript)
End If
End Sub
Public Sub UrlLocate(ByVal url As String, ByVal oPage As Page)
Dim strScript As String = "<script language=JavaScript>"
strScript += "document.location.href='" & url & "';"
strScript += "</script>"
If (Not oPage.IsStartupScriptRegistered("clientScript")) Then
oPage.RegisterStartupScript("clientScript", strScript)
End If
End Sub
Public Sub GoHistory(ByVal sLocation As String, ByVal oPage As Page)
Dim strScript As String = "<script language=JavaScript>"
strScript += "window.history.go('" & sLocation.ToString & "');"
strScript += "</script>"
If (Not oPage.IsStartupScriptRegistered("clientScript")) Then
oPage.RegisterStartupScript("clientScript", strScript)
End If
End Sub
Public Function DBNullToString(ByVal DBObj As Object) As String
If Not IsDBNull(DBObj) Then
Return Trim(DBObj.ToString)
Else
Return ""
End If
End Function
Public Function DBNullToInt(ByVal DBObj As Object) As Integer
If Not IsDBNull(DBObj) Then
Return CInt(DBObj)
Else
Return 0
End If
End Function
Function TrueLen(ByVal str As String) As Short
'求一个包含双字节字符的真实长度
Dim c As Char
Dim i As Short
Dim shtLen As Short = 0
For i = 0 To str.Length - 1
c = str.Chars(i)
shtLen += IIf(AscW(c) > 127, 2, 1)
Next
TrueLen = shtLen
End Function
Public Function GradeList(ByVal BackYears As Short, ByVal ForwardYears As Short) As String()
Dim i As Short
Dim Years As Short = BackYears + ForwardYears
Dim arrGrade(Years) As String
Dim curYear As Short = Date.Today.Year
For i = 0 To Years
arrGrade(i) = Right((curYear - BackYears + i).ToString, 2)
Next
Return arrGrade
End Function