Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to call aspx method from ascx?

Reply
Thread Tools

How to call aspx method from ascx?

 
 
Weblancer
Guest
Posts: n/a
 
      10-26-2007
subj

 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      10-26-2007
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?

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

*************************************************
| Think outside the box!
|
*************************************************
"Weblancer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> subj
>



 
Reply With Quote
 
 
 
 
Weblancer
Guest
Posts: n/a
 
      10-26-2007
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

 
Reply With Quote
 
IfThenElse
Guest
Posts: n/a
 
      10-26-2007
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?


"Weblancer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> 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
>



 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      10-29-2007
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.

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

*************************************************
| Think outside the box!
|
*************************************************
"Weblancer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Call a javascript when i call an aspx page with a form html not running on server Fabio Mastria ASP .Net 4 01-28-2008 09:05 AM
Syntax for call from aspx page to .cs file then to different aspx page MadHatter51 ASP .Net 1 05-17-2006 10:43 AM
Help: Call an ASPX page from a main ASPX page Progman ASP .Net 2 02-13-2006 01:39 AM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM



Advertisments