473,378 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Attaching to event in container object

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!
************************************************** ********************
Nov 17 '05 #1
3 1224
Probably a better approach would be to subscribe to the click event handler
of the button. This way, you get notified whenever the event fires. New
pages would just have to hook into the delegate and they would be notified
automatically, ie their methods would fire asynchronously releasing you from
much of the coding associated with monitoring for the event on all the pages
etc.

If you want the containing page you'd have to look for the owner or
container of the page which isn't necessarily the parent

regards

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:uR**************@TK2MSFTNGP09.phx.gbl...
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!
************************************************** ********************

Nov 17 '05 #2
I have already set up with the event in the control, which is fine, but I am
just geeky enough to try something a bit out of the box. ;-0

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
Probably a better approach would be to subscribe to the click event handler of the button. This way, you get notified whenever the event fires. New
pages would just have to hook into the delegate and they would be notified
automatically, ie their methods would fire asynchronously releasing you from much of the coding associated with monitoring for the event on all the pages etc.

If you want the containing page you'd have to look for the owner or
container of the page which isn't necessarily the parent

regards

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:uR**************@TK2MSFTNGP09.phx.gbl...
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!
************************************************** ********************


Nov 17 '05 #3
I have already set up with the event in the control, which is fine, but I am
just geeky enough to try something a bit out of the box. ;-0

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
Probably a better approach would be to subscribe to the click event handler of the button. This way, you get notified whenever the event fires. New
pages would just have to hook into the delegate and they would be notified
automatically, ie their methods would fire asynchronously releasing you from much of the coding associated with monitoring for the event on all the pages etc.

If you want the containing page you'd have to look for the owner or
container of the page which isn't necessarily the parent

regards

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:uR**************@TK2MSFTNGP09.phx.gbl...
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!
************************************************** ********************


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Yvan J. Gagnon | last post by:
I am currenly developing a web site using Macromedia fireworks, and am trying to figure out a way (through hand-coding) of attaching a javascript function (onClick="doit=false") to each of the...
0
by: BlueMonkMN | last post by:
I've been trying to think of the right way to design relationships between objects with different desired lifetimes that raise events. If an event source is a relatively permanent object and the...
0
by: 詹亚军 | last post by:
can activex control export large data to container by event's para ? I develop a activex control,and want to export large data to container(IE),web page can use javascript to capture the...
5
by: | last post by:
I am wondering what the best method of attaching custom Events to custom WebUserControls are. I cannot seem to find the proper terminology to expand my research. Basicallly I have a custom user...
4
by: Girish | last post by:
Im trying to create a grid within a grid programmatically. Ive been successful in doing this but I need the embedded grid to fire its ItemDataBound event so I can handle it. The event does not seem...
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
4
by: Antonio Carpentieri | last post by:
Hi all, in my previous post I've wrong typed some tems.. this is the corrected post. in a aspx page I have a repeater like this: <asp:repeater id=repeaterResults runat="server"...
6
by: Class | last post by:
Hi all, I create a gridview dynamicly because I don't know the columns in advance. I use the Templatefield to create a linkbutton. Everything fine..I have the postbackurl and it works. But now...
3
by: tswaters | last post by:
What a pain. I just pressed "Preview Post" only to find that the server forgot who I was and killed my input. So, where once I had everything described really nice, now I'm just going to write my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.