Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

How to call aspx method from ascx?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Weblancer - 26 Oct 2007 14:54 GMT
subj
Cowboy (Gregory A. Beamer) - 26 Oct 2007 14:59 GMT
Why not move the method to a code file that each can call? That is the first
step towards actually making a reusable library. While there are other ways
of handling this, the fact that you are reusing at the lower levels
indicates the functionality is needed elsewhere.

Or, do you not really need to "call" the method, but have it fire during
postback. If so, create event delegates in your ASCX that fire off events
that are handled in the page. This leads to a properly encapsulated user
control.

Perhaps something else?

Signature

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

*************************************************

| Think outside the box!

*************************************************
> subj
Weblancer - 26 Oct 2007 15:12 GMT
Yes mate thats exactly what i gonna do now i mean to write event
delegate. I wonder if it is any possibility to catch server events? i
mean when u press the button in UC some how parent knows that is not
his event and only UC after post_back loads it. So it sends some kind
of an event to the server (UC_Name.EVentName or smth ). So if it would
be possible it would be great :) Because on the middle of the post
back u could check if UC button was clicked do this and that :)
IfThenElse - 26 Oct 2007 16:23 GMT
If you have a button in a UC then the event handler to that button in the
code behind for that UC is called on post back
what is the issue?

> Yes mate thats exactly what i gonna do now i mean to write event
> delegate. I wonder if it is any possibility to catch server events? i
[quoted text clipped - 3 lines]
> be possible it would be great :) Because on the middle of the post
> back u could check if UC button was clicked do this and that :)
Cowboy (Gregory A. Beamer) - 29 Oct 2007 16:13 GMT
There are two basic patterns I employ.

1. UC triggered event - event delegate wired to the page
2. Page triggered event - Have method on UC to get information back to page

Either works and each is useful in different situations. The idea here is to
treat a UC like any other control and encapsulate the functionality so you
are using methods and events to communicate to other programming bits.

Signature

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

*************************************************

| Think outside the box!

*************************************************
> Yes mate thats exactly what i gonna do now i mean to write event
> delegate. I wonder if it is any possibility to catch server events? i
[quoted text clipped - 3 lines]
> be possible it would be great :) Because on the middle of the post
> back u could check if UC button was clicked do this and that :)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.