PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

aspx, ascx, and events

 
 
Peter K
Guest
Posts: n/a
 
      29th Apr 2010
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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: aspx ascx and events Andy O'Neill Microsoft ASP .NET 4 5th May 2010 10:18 AM
Re: aspx ascx and events Andy B. Microsoft ASP .NET 0 30th Apr 2010 12:59 AM
aspx ascx and events Peter K Microsoft C# .NET 4 29th Apr 2010 10:27 PM
Automatically create stubs for handling events from aspx/ascx sourceview? DC Microsoft ASP .NET 2 6th Mar 2008 04:09 PM
button in ascx not firing on aspx other than reload aspx MotorcycleIke Microsoft C# .NET 0 28th Sep 2005 02:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:06 PM.