aspx ascx and events

P

Peter K

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 way I do it, is that 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.

Then the aspx calls "SetResults" methods on the other ascx's, which can then
perform the handling and display they are required to do. Eg the "raw
display ascx" simple 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
 
A

Andy B.

The newsgroup microsoft.public.dotnet.framework.aspnet might be better able
to deal with your issue. That list is dedicated to asp.net. This one is
mainly windows forms/C# in general.
 
P

Peter K

Andy B. said:
The newsgroup microsoft.public.dotnet.framework.aspnet might be better
able to deal with your issue. That list is dedicated to asp.net. This one
is mainly windows forms/C# in general.

Yes - sorry - and thanks!

/Peter
 
A

Andy O'Neill

Peter K said:
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 way I do it, is that 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.

Then the aspx calls "SetResults" methods on the other ascx's, which can
then perform the handling and display they are required to do. Eg the "raw
display ascx" simple 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
That sounds a very complicated way to search for and display some data.
I can imagine why displaying data is the sort of thing you might want a user
control for.
I can't imagine why a search routine is a user control.
 
P

Peter K

Andy O'Neill said:
That sounds a very complicated way to search for and display some data.
I can imagine why displaying data is the sort of thing you might want a
user control for.
I can't imagine why a search routine is a user control.

Hi - thanks for your response. I've repeated the question in
microsoft.public.dotnet.framework.aspnet, so if you have any further
comments, I'd welcome them. For instance, where would you put the "search"
functionality (text box, button, response receiver) if not in its own
user-control?

/Peter

(ps. I've set "follow up to", on this message)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top