Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > post back event in server control

Reply
Thread Tools

post back event in server control

 
 
Jon Paal
Guest
Posts: n/a
 
      09-20-2006
how do I get the button event recognized in the post back from a server control ??


========code=============

Public Class MyButton
Inherits System.Web.UI.Page
Implements IPostBackEventHandler


Public Response As HttpResponse = HttpContext.Current.Response


' Defines the Click event.
'-----------------------------
Public Event Click As EventHandler

' OnClick dispatches the event to delegates that
' are registered with the Click event.
' Controls that derive from MyButton can handle the
' Click event by overriding OnClick
' instead of attaching a delegate. The event data
' is passed as an argument to this method.
'-----------------------------------------------
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 PostBackEventHandler.RaisePostBackEvent
OnClick(EventArgs.Empty)
System.Web.UI.Page.ClientScript.RegisterStartupScr ipt(Me.GetType(), "MyScript", _
"function AlertHello() { alert('Hello'); }", True)
End Sub 'RaisePostBackEvent

Public Sub New()
Response.Write("<INPUT TYPE = submit name = " & Me.UniqueID & " Value = 'Click Me' />")
End Sub


End Class


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does a dynamic control load post back data across post back?? =?Utf-8?B?Z29yaWxsYQ==?= ASP .Net 1 05-25-2007 05:02 AM
Problem for getting post back event in custom control. Reshma Prabhu ASP .Net 0 10-01-2006 03:36 PM
2nd attempt - post back event in server control Jon Paal ASP .Net Building Controls 0 09-24-2006 04:14 PM
How can i handle post back event of the control that is added on the OnPreRender () method Umut Tezduyar ASP .Net Web Controls 8 10-08-2004 10:03 AM
How can i handle post back event of the control that is added on the OnPreRender () method Umut Tezduyar ASP .Net 1 10-06-2004 09:10 AM



Advertisments