aspx, ascx, and events

Discussion in 'ASP .Net' started by Peter K, Apr 29, 2010.

  1. Peter K

    Peter K Guest

    Hi, is the following a reasonable way to do things, or what would be better?

    The set up is as follows:
    I have an aspx, with many ascx's on it. The ascx's are not aware of each
    other, but they do depend on data from each other.

    Eg.
    (1) "search ascx" which accepts user input, and issues a request to a url
    and receives the returned xml (a list of shop data).
    (2) "raw display ascx" which displays the xml as-is.
    (3) "list display ascx" which processes the xml and displays only the
    returned "shop names" from the xml.

    The "search ascx" has a "search event" which the main aspx subscribes to.
    When the "search ascx" receives the xml, it signals the "search event", and
    the aspx then receives the xml string in its handler method.

    The aspx calls "SetResults" methods on the ascx's, which can then
    perform the handling and display they are required to do. Eg the "raw
    display ascx" simply formats the xml "beautifully" and displays it, while
    the "list display ascx" processes the xml to retrieve the shop names.

    But, the aspx only really knows it has a "search ascx" - there could be many
    types of "results handler" ascx's. So I make the ascx's implement a
    "IResultsHandler" interface (which has a "SetResults" method). When the
    aspx's event handler for results is called, it loops over all its controls,
    finds those that implement IResultsHandler, and calls the method. Is that
    reasonable?

    Thanks,
    Peter
     
    Peter K, Apr 29, 2010
    #1
    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:
    489
    Quentin
    Jul 29, 2003
  2. Jason Shohet
    Replies:
    1
    Views:
    485
    Kevin Spencer
    Nov 10, 2003
  3. Holger (David) Wagner
    Replies:
    2
    Views:
    1,944
    Holger (David) Wagner
    Jul 3, 2004
  4. DC
    Replies:
    2
    Views:
    652
  5. Andy O'Neill

    Re: aspx ascx and events

    Andy O'Neill, Apr 30, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    546
    Andy O'Neill
    May 5, 2010
Loading...

Share This Page