How to call aspx method from ascx?

Discussion in 'ASP .Net' started by Weblancer, Oct 26, 2007.

  1. Weblancer

    Weblancer Guest

    subj
     
    Weblancer, Oct 26, 2007
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > subj
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 26, 2007
    #2
    1. Advertising

  3. Weblancer

    Weblancer Guest

    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 :)
     
    Weblancer, Oct 26, 2007
    #3
  4. Weblancer

    IfThenElse Guest

    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" <> wrote in message
    news:...
    > 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, Oct 26, 2007
    #4
  5. 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" <> wrote in message
    news:...
    > 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 :)
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 29, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Quentin
    Replies:
    1
    Views:
    508
    Quentin
    Jul 29, 2003
  2. Jason Shohet
    Replies:
    1
    Views:
    500
    Kevin Spencer
    Nov 10, 2003
  3. Holger (David) Wagner
    Replies:
    2
    Views:
    1,968
    Holger (David) Wagner
    Jul 3, 2004
  4. comp
    Replies:
    2
    Views:
    4,799
    Karl Seguin
    Nov 26, 2004
  5. Joe
    Replies:
    1
    Views:
    396
    Jeffrey Tan[MSFT]
    Feb 16, 2004
Loading...

Share This Page