Asp.net 使用其类型隐藏日期选择器

Asp.net 使用其类型隐藏日期选择器,asp.net,vb.net,Asp.net,Vb.net,我使用下面的代码来隐藏文本框、标签和下拉列表。但是我怎么才能隐藏一个约会挑肥拣瘦的人呢?我可以在下面的代码中对datepicker执行相同的操作吗 If (TypeOf ctrTexbox Is TextBox) Then If isMasked Then CType(ctrLabel, Label).Visible = True CType(ctrTexbox, TextBox).Visible = False

我使用下面的代码来隐藏文本框、标签和下拉列表。但是我怎么才能隐藏一个约会挑肥拣瘦的人呢?我可以在下面的代码中对datepicker执行相同的操作吗

 If (TypeOf ctrTexbox Is TextBox) Then
        If isMasked Then
            CType(ctrLabel, Label).Visible = True
            CType(ctrTexbox, TextBox).Visible = False
        Else
            CType(ctrLabel, Label).Visible = False
            CType(ctrTexbox, TextBox).Visible = True
        End If
    ElseIf (TypeOf ctrTexbox Is DropDownList) Then
        If isMasked Then
            CType(ctrLabel, Label).Visible = True
            CType(ctrTexbox, DropDownList).Visible = False
        Else
            CType(ctrLabel, Label).Visible = False
            CType(ctrTexbox, DropDownList).Visible = True
        End If
日期选择器的html

  <BDP:BasicDatePicker Style="z-index: 205; left: 312px" ID="dtp" runat="server" width="250px" SelectedDate="1989-01-01" DateFormat="dd/MMM/yyyy">                                                                                
  <TextBoxStyle CssClass="inputbox" Width="250px" /></BDP:BasicDatePicker>

当然可以,因为它也是从同一
网络控制
类派生的:

ElseIf (TypeOf ctrTexbox Is BasicFrame.WebControls.BasicDatePicker) Then
    If isMasked Then
        CType(ctrLabel, Label).Visible = True
        CType(ctrTexbox, BasicFrame.WebControls.BasicDatePicker).Visible = False
    Else
        CType(ctrLabel, Label).Visible = False
        CType(ctrTexbox, BasicFrame.WebControls.BasicDatePicker).Visible = True
    End If

在代码隐藏上,
ID.visible=false