Protected ReadOnly Property HelperID () As String Get Return "__" & ClientID & "_State" End Get End Property Protected Overrides Sub OnInit (e As EventArgs) MyBase.OnInit (e) If Not (Page Is Nothing) Then Page.RegisterRequiresPostBack ( Me) End If End Sub Protected Overrides Sub OnPreRender (e As EventArgs) MyBase.OnPreRender (e) If Not (Page Is Nothing) Then Page.RegisterHiddenField (HelperID, Selected.ToString ()) End If End Sub Protected Overrides Sub Render ( writer As HtmlTextWriter) Dim postback As String = "" If Not (Page Is Nothing) Then postback = Page.GetPostBackEventReference (Me) & ";" End If Dim click As String = "οnclick =" "var sel = getAttribute ( 'selected '); SEL = (SEL.TOLOWERCASE () ==' True '); SEL =!
SetAttribute ('SELECTED', SEL.TOSTRING ()); this.Style.BackgroundColor = SEL? 'Red': 'White'; "& helperid &" .Value = SEL.TOSTRING (); "& Postback &
"" "" "" "DIM STYLE AS STRING =" style = "" Cursor: Hand; Background-Color: "& IIF (SELECTED," RED "," White "). Tostring () &" "" "DIM SELECTEDPIECE AS STRING = "SELECTED =" "& selected.to" "" "" Writer.write ((" & text & " span> ")) End Sub Function LoadPostData (postDataKey As String, postCollection As NameValueCollection) As Boolean ImplementsIPostBackDataHandler.LoadPostData Dim value As String = postCollection (HelperID) If Not (value Is Nothing) Then Dim newValue As Boolean = String.Compare (value," true ", True) = 0 Dim oldValue As Boolean = Selected Selected = newValue 'If there is a change, raise a change event. Return newValue <> oldValue End If Return False End Function Sub RaisePostDataChangedEvent () Implements IPostBackDataHandler.RaisePostData Changedeevent 'there is a change, so rasne any events. Raiseeevent successdedchanged (me, evenetargs.empty) end sub
The relevant information of the Page class is related to the relevant information of the Page class. Named container for the child's control or the child's sub-level of the control. The signature of the Page class is as follows: Public class page inherits TemplateControl Implements IHTTPHANDLER ...
The TemplateControl class provides a set of basic features for the Page class and the UserControl class, which is as follows: Mustinherit Public Class TemplateControl Inherits Control Implements InamingContainer ... Page class properties:
ClientID (inherited from Control) The server control identifier generated by the ASP.NET regardless of whether the ID attribute of the server control is specified, the ASP.NET automatically generates a clientID for the server control to identify the client's control. Any ID property is assigned to The name of the server control is overwritten this property value public overridable readonly Prorty ClientID AS String
Id Page class identifier Overrides Public Property ID AS String
NamingContainer gains a named container iron reference to the server control to distinguish server control publish Overridable Readonly Property NamingContainer AS Control UNIQUEID with the same control.id attribute value, which is unique to the server control, and the identifier defined by the hierarchical form is different. This property contains a compament of the server control named container. Automatically generate this identifier when processing page requests This property is used to distinguish the nested control. In particular, it is especially important in the form of the page is MyRepeater: CT10: Mylabel MyRepeater: CTL1: Mylabel, etc. Public Overridable Readonly Property Uniqueid AS String
User information about the user's information This property uses the HTTPContext object to get the user who is requesting the page for authentication information public readonly Property User As IPrincipal.
The collection of all validation controls included on the Validators page calls the page.validate method will result in the verification logic operations to each verification service control included in the collection, and then set the page.issalid property.
Public ReadOnly Property Validators as ValidatorCollect method: GetPostBAckClientEvent get references to client-side script function that when called will result in service clamor back to the window Public Function GetPostBackClientEvent (byval Control as control, argument as string) as string 'control: receiving client postback event server control 'argument: string parameter passed to the method IPostBackEventHandler.RaisePostBackEvent' return: StringGetostBackClientHyperLink client event will be added to the beginning of GetPostBackEventReference javascript calls returned, so that the server can send back a hyperlink Process Public Function GetPostBackClienyperLink (Control as Control, Argument As String) AS String
'Control: Processing the backstage server control. 'Argument: Parameters pass to the server control. 'Return: The name of the client function and the id attribute of the server control of the control and the server control of the control.
GetPostBackeVentReference Gets a reference to the client script function, calling this function to send the server back to the page Overloads Public Function GetPostBackeventReference (Control AS Control) AS String 'Control: To process the return server control on the server. 'Return: the text that can be inserted into the client function handler
OverLoads Public Function GetPostBackeventReference (Control as Control, Argument As String) AS String 'Control: To process the return server control. 'Argument: Parameters pass to the server control. 'Return: The text can be inserted into the client function called by the client event handler.
Protected Overrides Sub Render (Writer as HTMLTextWriter) Writer.write ((" Increase
Number ")) Writer.write (" or ") Writer.write ((" Decreasenumber A> ")) End Sub 'Render
IsclientScriptBlockRegistered determines whether the page registers the client script PUBLIC FUNCLIENTScriptBlockRegistered (Key As String) AS Boolean 'Key: To search the client script string "Return: True / False
Sub Page_Load (sender as Object, e as EventArgs) Dim scriptString as String = "