my problem is this: i want to create a server control that inherits System.Web.UI.WebControls.Button but gives it special capability, now what do i mean? i want my button to be a confiorm button that will work like so:
renders to the page as a button of lets say cancel after the user clicks it i want to catch the click event (within the server control) and now after the click makeing the button not visible and makeing some kind of c开发者_StackOverflowontent placeholder (that will render from the server control) visible. that content place holder will have 2 buttons inside of it: yes and cancel
i want the programmer that adds this control to be able to register a function to the click event of the yes button.
and the second cancel confirmation button should make the first button appear agian.
(i know how to do this all in the client side but this time i need it all as server events)
my question is this: how do i catch the click event? i want it all to be handled inside the server control itself. so a programmer that adds this control wont have to worry about anything but just needs to register to the click event of the "yes" button
thank you
Since you want to have multiple controls in your server control you'll have to inherit from the CompositeControl class and manually add each control and manage the different controls visibility. To add the event handler, use the AddHandler keyword.
AddHandler YourButton.Click, AddressOf SubThatHandlesTheButtonClickEvent
精彩评论