本文整理汇总了VB.NET中System.Web.HttpParseException类的典型用法代码示例。如果您正苦于以下问题:VB.NET HttpParseException类的具体用法?VB.NET HttpParseException怎么用?VB.NET HttpParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HttpParseException类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: AddParsedSubObject
' 导入命名空间
Imports System.Security.Permissions
Imports System.Collections
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Namespace Samples.AspNet.VB
' Define a child control for the custom HtmlSelect.
Public Class MyCustomOption
Private _id As String
Private _value As String
Public Property optionid() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End Property
Public Property value() As String
Get
Return _value
End Get
Set(ByVal value As String)
_value = value
End Set
End Property
End Class
' Define a custom HtmlSelectBuilder.
Public Class MyHtmlSelectBuilderWithparseException
Inherits HtmlSelectBuilder
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Overrides Function GetChildControlType(ByVal tagName As String, ByVal attribs As IDictionary) As Type
' Distinguish between two possible types of child controls.
If tagName.ToLower().EndsWith("mycustomoption") Then
Return GetType(MyCustomOption)
Else
Throw New HttpParseException("This custom HtmlSelect control" & _
"requires child elements of the form ""MyCustomOption""")
End If
End Function
End Class
<ControlBuilderAttribute(GetType(MyHtmlSelectBuilderWithparseException))> _
Public Class CustomHtmlSelectWithHttpParseException
Inherits HtmlSelect
' Override the AddParsedSubObject method.
Protected Overrides Sub AddParsedSubObject(ByVal obj As Object)
Dim _outputtext As String
If TypeOf obj Is MyCustomOption Then
_outputtext = "custom select option : " + CType(obj, MyCustomOption).value
Dim li As New ListItem(_outputtext, CType(obj, MyCustomOption).value)
MyBase.Items.Add(li)
End If
End Sub
End Class
End Namespace