⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usercontrol3.ascx

📁 几个不错的ASP.NTE例子
💻 ASCX
字号:
<script language="VB" runat="server">
Private m_FontColor As System.Drawing.Color
Private m_Counter As Integer
Public Property Address1 As String
	Get
		Address1 = txtAddress1.text
	End Get
	Set
		txtAddress1.text = value
	End Set
End Property
Public Property Address2 As String
	Get
		Address2 = txtAddress2.text
	End Get
	Set
		txtAddress2.text = value
	End Set
End Property
Public Property City As String
	Get
		City = txtCity.text
	End Get
	Set
		txtCity.text = value
	End Set
End Property
Public Property StateID As String
	Get
		StateID = cmbStateID.Items(cmbStateID.SelectedIndex).Value
	End Get
	Set
		For m_Counter = 0 To (cmbStateID.Items.Count - 1)
			If cmbStateID.Items(m_Counter).Value = value Then
				cmbStateID.SelectedIndex = m_Counter
			End If 
		Next
	End Set
End Property
Public Property ZipCode As String
	Get
		ZipCode = txtZipCode.text
	End Get
	Set
		txtZipCode.text = value
	End Set
End Property
Public Property FontColor As System.Drawing.Color
	Get
		FontColor = m_FontColor
	End Get
	Set
		m_FontColor = value
		Address1Label.ForeColor = value
		Address2Label.ForeColor = value
		CityLabel.ForeColor = value
		StateLabel.ForeColor = value
		ZipCodeLabel.ForeColor = value
	End Set
End Property
Public Property BGColor As System.Drawing.Color
	Get
		BGColor = Address.BackColor
	End Get
	Set
		Address.BackColor = value
	End Set
End Property
Public Function ValidateAddress() As Boolean
	If Trim(txtAddress1.text) = "" Then
		return False
		Exit Function
	End If
	If Trim(txtCity.text) = "" Then
		return False
		Exit Function
	End If
	If cmbStateID.SelectedIndex = 0 Then
		return False
		Exit Function
	End If
	If Trim(txtZipCode.text) = "" Then
		return False
		Exit Function
	End If
	return True
End Function
Sub Page_Load(Sender As Object, E As EventArgs)
	If Not Page.isPostBack Then
		Dim oItem As New ListItem
		With oItem
			.Value = 10
			.Text = "安徽"
		End With
		cmbStateID.Items.Add(oItem)
	End If
End Sub
Private Sub btnSubmit_Click(Sender As Object, E As EventArgs)
	Response.Write("!")
End Sub
</script>
<asp:Panel ID="Address" runat="server">
  <asp:Table ID=AddressTable runat="server">
    <asp:TableRow ID=Address1Row runat="server">
      <asp:TableCell ID=Address1Cell runat="server">
        <asp:Label ID=Address1Label text="地址:" runat="server" /></BR>
        <asp:Textbox ID=txtAddress1 columns=25 maxlength=50 runat="server" />
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow ID=Address2Row runat="server">
      <asp:TableCell ID=Address2Cell runat="server">
        <asp:Label ID=Address2Label text="电话:" runat="server" /></BR>
        <asp:Textbox ID=txtAddress2 columns=25 maxlength=50 runat="server" />
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow ID=CityRow runat="server">
      <asp:TableCell ID=CityCell runat="server">
        <asp:Label ID=CityLabel text="城市:" runat="server" /></BR>
        <asp:Textbox ID=txtCity columns=25 maxlength=50 runat="server" />
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow ID=StateRow runat="server">
      <asp:TableCell ID=StateCell runat="server">
        <asp:Label ID=StateLabel text="省份:" runat="server" /></BR>
        <asp:DropDownList ID=cmbStateID  runat="server">
          <asp:ListItem selected=true></asp:ListItem>
          <asp:ListItem value=2>山东</asp:ListItem>
          <asp:ListItem value=3>陕西</asp:ListItem>
        </asp:DropDownList>
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow ID=ZipCodeRow runat="server">
      <asp:TableCell ID=ZipCodeCell runat="server">
        <asp:Label ID=ZipCodeLabel text="邮编:" runat="server" /></BR>
        <asp:Textbox ID=txtZipCode columns=10 maxlength=5 runat="server" />
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow ID=SubmitRow runat="server">
      <asp:TableCell ID=SubmitCell horizontalalign=center runat="server">
        <asp:Button ID=btnSubmit text="提交" onClick="btnSubmit_Click" runat="server" />
      </asp:TableCell>
    </asp:TableRow>
  </asp:Table>
</asp:Panel>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -