Learning of server control - processing faster

xiaoxiao2021-03-06  111

To capture the control, the control must be implemented

System.Web.ui.ipostbackeventhandler

interface. The agreement of this interface allows the control to raise an event on the server respond to the return from the client. public InterFace IPostbackEventhandler sub RaisePostBackEvent (eventArgument as string) after the end interface postback, the page frame will be sent to search for content and determine whether to send the name of the corresponding server controls and implementation IPostbackEventHandler of UniqueID, if the correspondence, the page frame will be at the controls on the call RaisePostBackEvent method Public Overridable Sub RaisePostDataChangedEvent () Implements IPostBackDataHandler.RaisePostDataChangedEvent OnTextChanged (EventArgs.Empty) End Sub UniqueID presentation logic must assign the name of the control characteristics, as in the following example. If the client's control name features do not match their UNIQUEID, the page frame cannot transmit the return event to the control. Protected Overrides Sub Render (Output as HTMLTextWriter) Output.write ("") End Subs All Code: Option ExplicitOption Strict

Imports SystemImports System.Web.ui

Namespace CustomControls Public Class MyButton Inherits Control Implements IPostBackEventHandler 'Defines the Click event. Public Event Click As EventHandler' Invokes delegates registered with the Click event. Protected Overridable Sub OnClick (e As EventArgs) RaiseEvent Click (Me, e) End Sub 'Method of IPostBackEventHandler that raises change events. Public Sub RaisePostBackEvent (eventArgument As String) Implements IPostBackEventHandler.RaisePostBackEvent OnClick (EventArgs.Empty) End Sub Protected Overrides Sub Render (output As HtmlTextWriter) output.Write ( "") End Sub End Classend Namespace

转载请注明原文地址:https://www.9cbs.com/read-102683.html

New Post(0)