Look like your understanding of ASP.Net might not be the best... Well.
Ok. You're control has three "parts":
- categories
- books
- details about a book
Ok. Let's try to simulate the behavior.
On first page load, you display only categories. And if you have a default
category also books about it.
The user then either:
- clicks a book to see its details or
- select another category
Postback occures.
You just create your your control in the pageLoad (if it's not static on teh
ASPX - which would be just fine) and databind books. Category could be
stored in viewstate so you bind to correct books.
Ok. Then you have a handler for:
- CategoryChange event and
- Book click event
Ok.
The one that happens will fire. If the category change fires you get the new
category and load apropriate books
If the book click happens, you display it's details.
I don't see a reason for PreRender event. It's just Page.Load,
DropDownList.Change, book.Click...
Everything can be handled "normally".
Ok. About book details. If your book was clicked you also have to store book
ID or something of the last selected book to databind it's details in the
page load.
that's all to it.
the page gets returned to the client. and everything goes on from the
beginning.
Or maybe I'm the one that doesn't get the idea of this behavior which is
also run on amazon (in it's own version).
BTW. You could also create three controls:
- categories
- books
- details
which you could use on other pages separately. On the page that they all
exist, those controls could provide data for one another.
--
RobertK
{ Clever? No just smart. }
[quoted text, click to view] "Umut Tezduyar" <utezduyar@onmap.com.tr> wrote in message
news:OQ$I5S5qEHA.376@TK2MSFTNGP14.phx.gbl...
> You have understood my problem exactly right.
> I will give you an example why i need to add control on the on prerender.
>
> Ex: Assume that i have a control. This control has three functions
> 1) Displaying book categories
> 2) Displaying books under selected categories
> 3) Showing the book details for the selected book.
>
> Here is the scenario:
> User sees books categories and selects one of them.
> User sees books under the selected categories.
> User selects a book from the list and sees its details.
>
> Here is the code part.
>
> OnLoad
> Load the category list buttons to the system.
> RaisePostBackEvent
> Here it is determined which category is selected by understanding
> which category button is pressed
> OnPreRender
> Loads book list and a button foreach book, that when it is clicked
> to it, it shows the book details.
>
> I wish i am clear enough to explain my problem. I can explain it more
> briefly if it is not clear for you. I am waiting answers from you. Thank
> you.
>
> "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
> news:TVieGP4qEHA.404@cpmsftngxa06.phx.gbl...
> > Hi Umut,
> >
> > From your description, you 're developing a custom sever control which
is
> > adding some sub controls in the PreRender event, but this cause those
sub
> > control's postback event unable to be fired, yes?
> >
> > As for this problem, i'm afraid it is a by design behavior since the
> > controls'(on the page) 's postback event processing occurs when the
page's
> > postback event handling occurs during page's serverside execution cycle
> > and
> > we can't manually change that sequence or manually recall the post back
> > processing.
> >
> > BTW, would you please tell us the reason why you need to add the
controls
> > in the PreRender event, is there any particular needs? If so, we may try
> > finding some other means to workaround it. Thanks.
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure!
www.microsoft.com/security > > (This posting is provided "AS IS", with no warranties, and confers no
> > rights.)
> >
>
>