''' <summary>
''' 画面上的控件是否可用设定
''' </summary>
''' <param name="paraControl">控件(VIEW)</param>
''' <param name="paraStrCtrlName">画面上控件ID为元素的数组</param>
''' <param name="status">设定状态是否可用</param>
''' <remarks></remarks>
Protected Sub setControlsStatus(ByVal paraControl As System.Web.UI.Control, ByVal paraStrCtrlName() As String, ByVal status As Boolean)
If paraControl Is Nothing Then
Throw New ArgumentNullException
End If
'Control数取得
Dim intCount As Integer = UBound(paraStrCtrlName)
Dim ctrlName As String = Nothing
'VisibleStatus設定
For i As Integer = 0 To intCount
ctrlName = paraStrCtrlName(i)
If ctrlName Is Nothing Then
Throw New ArgumentNullException
End If
Dim objControl As Control = paraControl.FindControl(ctrlName)
If Not IsNothing(objControl) Then
Dim strType As String = objControl.GetType().ToString()
'HTMLコントロールの時
If Left(strType.Substring(strType.LastIndexOf(".") + 1), 4) = "Html" Then
CType(objControl, Object).disabled = Not status
'WEBコントロールの時
Else
CType(objControl, Object).enabled = status
End If
End If
Next
End Sub
''' <summary>
''' 画面上的CheckBox状态的设定
''' </summary>
''' <param name="paraControl">控件(VIEW)</param>
''' <param name="paraStrCtrlName">画面上控件ID为元素的数组</param>
''' <param name="status">设定状态是否选中</param>
''' <remarks></remarks>
Protected Sub setCheckStatus(ByVal paraControl As System.Web.UI.Control, ByVal paraStrCtrlName() As String, ByVal status As Boolean)
If paraControl Is Nothing Then
Throw New ArgumentNullException
End If
'Control数取得
Dim intCount As Integer = UBound(paraStrCtrlName)
Dim ctrlName As String = Nothing
'VisibleStatus設定
For i As Integer = 0 To intCount
ctrlName = paraStrCtrlName(i)
If ctrlName Is Nothing Then
Throw New ArgumentNullException
End If
Dim objControl As Control = paraControl.FindControl(ctrlName)
If Not IsNothing(objControl) Then
CType(objControl, CheckBox).Checked = status
End If
Next
End Sub
不错
最新推荐文章于 2024-09-12 18:02:32 发布