PC Review


Reply
Thread Tools Rate Thread

How to handle this event?

 
 
234
Guest
Posts: n/a
 
      9th Jan 2005
I have a button for which I want to handle the click event. Here is my
setup:

The base page, simplified for discussion:
=================================

Public Class clsBasePage
Inherits System.Web.UI.Page

Public objForm As New HtmlForm
Public anHTMLTextWriter as HTMLTextWriter
_________________________________

Private Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Init

With objForm
.Enctype = "application/x-www-form-urlencoded"
.EnableViewState = True
.ID = "frmForm"
End With

Me.Controls.Add(objForm)

End Sub

End Class

=================================

During the base page's render event, anHTMLTextWriter is assigned to the
exposed html text writer.

Here's a simplified example of the derived page I'm working with:

=================================

Public Class myDerivedPage
Inherits clsBasePage

Private txtName As New TextBox
Protected WithEvents btnSave As New Button
_________________________________

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

With Me.objForm
.Controls.Add(Me.txtName)
.Controls.Add(Me.btnSave)
.RenderControl(Me.anHTMLTextWriter)
End With

End Sub
_________________________________

Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

Response.Write("btnSave.Click<br>")

End Sub

End Class

=================================

Other than the directive statement <%@ Page Language="vb"... etc, the .aspx
file of both the derived and base page have no content.

If I run this project, surf to the derived page and click the 'save' button,
it triggers a postback but the btnSave_Click routine is never called. I
have tried using an HTMLButton object, instead of a Button object, and
handling the .ServerClick event. I've tried AddHandler to implicitly define
a handler, but I have no success in consuming the Click and/or ServerClick
events (depending on which button object is used).

I feel I am missing something fundamental here, can someone point me in the
right direction? TIA.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Easy to get handle from listbox. How to get listbox from handle? IMAFriend Microsoft Dot NET 0 28th Mar 2008 02:31 AM
Fill handle turned into a move handle =?Utf-8?B?Tm9ydGh3b29kcw==?= Microsoft Excel Misc 1 2nd Mar 2007 04:40 PM
Possible to handle web requests without an ASPX page? i.e. have DLL handle request. jdlwright@shaw.ca Microsoft ASP .NET 2 31st May 2005 06:42 PM
reference to handle / handle to reference =?Utf-8?B?Q2hyaXN0aWFuIExhbW1lbA==?= Microsoft Dot NET 3 15th Jan 2005 03:28 AM
How to: Object to pointer/handle and pointer/handle to Object Johann Microsoft Dot NET Framework 1 12th Aug 2004 06:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:04 AM.