|
 |
aspx_professional thread: Creating multiple interfaces in custom server control.
Message #1 by agamble@t... on Tue, 25 Jun 2002 22:44:19
|
|
I wondered if anyone could provide assistance on the best way in which to
provide the following in a custom server control.
What I want to do create is a server control, which displays one user
interface when initially displayed. It will contain two different type of
submit buttons, one of them just posts back and basically just raises an
event but doesn;t change the user interface in anyway. However the other
button posts back, but on post back I would like to be able to display a
different user interface entirely. This will allow more advanced selection
on the control, and then be able to post back from this user interface you
the original user interface.
I want the control to always be on the same form and the display to be
either one interface or the other. i don't want both displayed at once and
I don't a combination of both.
I could write this as an aspx form no problems, but the propblem I have is
that I want to encapsulate all of this into one custom server control.
I have started by creating a composite server control and using
createchildcontrols to provide the original user interface. The second
button is implemented by adding a asp button control and assigning an
event to the click event of the control. The problem is that when the post
back occurs the createchildcontrols is fired before the event handler for
the buton is fired. Therefore the controls are already added to the page
before the submit event is called which is where I wanted to create the
second user interface.
How would I get round this, or should I even be considering doing this.
Two approaches I think might work would be to 1. in createchildcontrols
check to see if page.postback is true and display the second user
interface. This would be a problem when going back to the first user
interface because this would also be a postback. or 2. split both of the
user interfaces into seperate controls in their own right. And then use a
web form to glue the pieces together as required.
Would anyone be able to provide their thoughts on whether I am on the
right lines or whether there would be a better way to acheive this.
Thanks
|
|
 |