C
Cowboy \(Gregory A. Beamer\)
I have a user control that has a group of links. It is included on every
page of a web application. Some of the pages are forms, and the requirements
state "if any of the data has changed, you must ask the user if they want to
save the changes." I can solve this by dynamically setting a group of
LinkButton controls and adding a common event handler in the control.
On non-form pages, I can redirect the person to the linked page without
doing anything. On form pages, I have to check and save the data if the user
desires. I can code this in the control, but it means I have to check every
time a person clicks on the LinkButton(s).
What I would like to experiment with is setting up the lb_Click() event
handler in the Page and link the Control to the event in the page. This will
allow me to simply redirect on non-form pages and handle the data on form
pages. The code is simplified over the control embedded event handler, as I
do not have to check the type of page.
I can, of course, kludge up the works a bit by setting a property on the
control (which actually may be a better solution), but I would still like to
play with the container (page) of a control.
The question is whether or not it can easily be done.
this.Page does not seem to return the containing page
this.Parent returns the base class (as expected)
Just curious as to this.? gives me the object that the control is sitting on
(ie, the container).
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
**********************************************************************
Think Outside the Box!
**********************************************************************
page of a web application. Some of the pages are forms, and the requirements
state "if any of the data has changed, you must ask the user if they want to
save the changes." I can solve this by dynamically setting a group of
LinkButton controls and adding a common event handler in the control.
On non-form pages, I can redirect the person to the linked page without
doing anything. On form pages, I have to check and save the data if the user
desires. I can code this in the control, but it means I have to check every
time a person clicks on the LinkButton(s).
What I would like to experiment with is setting up the lb_Click() event
handler in the Page and link the Control to the event in the page. This will
allow me to simply redirect on non-form pages and handle the data on form
pages. The code is simplified over the control embedded event handler, as I
do not have to check the type of page.
I can, of course, kludge up the works a bit by setting a property on the
control (which actually may be a better solution), but I would still like to
play with the container (page) of a control.
The question is whether or not it can easily be done.
this.Page does not seem to return the containing page
this.Parent returns the base class (as expected)
Just curious as to this.? gives me the object that the control is sitting on
(ie, the container).
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
**********************************************************************
Think Outside the Box!
**********************************************************************