最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
引发自定义控件LoadPostData方法的必要条件!
时间:2022-06-30 10:22:18 编辑:袖梨 来源:一聚教程网
自定义控件要引发LoadPostData方法,需要包含一个ID为this.UniqueID的控件
可在控件组中加入一个Hidden控件!
writer.Write("")
或者干脆更简单的做法,把submit的name属性设置为me.UniqueID
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
{0}:Login>")> Public Class Login
Inherits System.Web.UI.WebControls.WebControl
Implements IPostBackDataHandler
Public Event CheckError As EventHandler
Private _user As String
Private _pass As String
Public Function LoadPostData(ByVal postDataKey As String, ByVal postCollection As System.Collections.Specialized.NameValueCollection) As Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData
_user = CType(postCollection(Me.UniqueID & ":User"), String)
_pass = CType(postCollection(Me.UniqueID & ":Pass"), String)
If _user <> _pass Then
Return True
Else
Return False
End If
End Function
Public Sub RaisePostDataChangedEvent() Implements System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent
OnCheckError()
End Sub
Public Sub OnCheckError()
RaiseEvent CheckError(Me, New System.EventArgs())
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
writer.RenderBeginTag(HtmlTextWriterTag.Table)
writer.RenderBeginTag(HtmlTextWriterTag.Tr)
writer.RenderBeginTag(HtmlTextWriterTag.Td)
writer.Write("用户名:")
writer.RenderEndTag()
writer.RenderBeginTag(HtmlTextWriterTag.Td)
writer.AddAttribute(HtmlTextWriterAttribute.Type, "TextBox")
可在控件组中加入一个Hidden控件!
writer.Write("")
或者干脆更简单的做法,把submit的name属性设置为me.UniqueID
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
Inherits System.Web.UI.WebControls.WebControl
Implements IPostBackDataHandler
Public Event CheckError As EventHandler
Private _user As String
Private _pass As String
Public Function LoadPostData(ByVal postDataKey As String, ByVal postCollection As System.Collections.Specialized.NameValueCollection) As Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData
_user = CType(postCollection(Me.UniqueID & ":User"), String)
_pass = CType(postCollection(Me.UniqueID & ":Pass"), String)
If _user <> _pass Then
Return True
Else
Return False
End If
End Function
Public Sub RaisePostDataChangedEvent() Implements System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent
OnCheckError()
End Sub
Public Sub OnCheckError()
RaiseEvent CheckError(Me, New System.EventArgs())
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
writer.RenderBeginTag(HtmlTextWriterTag.Table)
writer.RenderBeginTag(HtmlTextWriterTag.Tr)
writer.RenderBeginTag(HtmlTextWriterTag.Td)
writer.Write("用户名:")
writer.RenderEndTag()
writer.RenderBeginTag(HtmlTextWriterTag.Td)
writer.AddAttribute(HtmlTextWriterAttribute.Type, "TextBox")
相关文章
- 光遇12.23每日任务怎么做 光遇12月23日每日任务做法攻略 12-23
- 光遇12.23大蜡烛在哪里 光遇12月23日大蜡烛位置攻略 12-23
- 光遇12.23免费魔法有什么 光遇12月23日免费魔法收集攻略 12-23
- 《流放之路2》寻找熔炉任务攻略分享 12-23
- 《流放之路2》德雷文打法技巧分享 12-23
- 《流放之路2》永恒裁判者德雷文具体位置介绍 12-23