日期:2009-12-20 浏览次数:20457 次
<?xml version="1.0"? encoding="GB2312"> <words> <word>词语一</word> <word>词语二</word> </words> |
// 将操作委托给标签对象,标签对象是一个 // System.Web.UI.WebControls.Label的实例 Public Property Text() As String Get EnsureChildControls() Return label.Text End Get Set EnsureChildControls() label.Text = value End Set End Property |
<%@ page language="vb" debug="false" trace="false" %> <%@ Register TagPrefix="Custom" Namespace="CustomControls" Assembly = "CustomControls" %> <html> <script language="VB" runat=server> Private Sub CheckText(sender As Object, e As CheckEventArgs) If e.Match = false Then Composite.Text = "<h2>发布内容请遵守本站规则!不得发布攻击性言辞!</h2>" Else Composite.Text = "你提交的内容已通过检查!" End If End Sub </script> <body> <h1>语言净化控件实例</h1><br> <form runat=server> <Custom:Composite id = "Composite" OnCheck = "CheckText" filename = "bad_words.xml" runat = server/></form></body> </html> |
Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Xml Imports System.Collections Namespace CustomControls Public Class Composite Inherits Control Implements INamingContainer Private _filename As String = "bad_words.xml" Private label As Label Private box1 As TextBox Public Property filename() As String Get Return _filename End Get Set _filename = value End Set End Property ' 以用户提交的文本内容为输入参数。如果用户提交的内容包含攻击性言辞, ' 则返回修改后的版本, ' 否则,直接返回原始的文本。 Public Function CheckStrin
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料更多> |