Is This Possible: Client Side Web Parts Disappear

  • Thread starter Thread starter Steve Commisso
  • Start date Start date
S

Steve Commisso

I'm working with the following scenario:

I'm building a wizard. Each 'step' of the wizard is its own User Control
page. I'm trying to minimize the 'round trips' (e.g. runat=server) I
make to the server so I want to try to do the following:

When the user clicks the 'next' button on one user control, that control
disappears and the next 'step' in the wizard appears.

So to dothis, I load all of the User Controls as web parts, and then
possibly set the .Visible property on them to make them disappear -- but
for this to happen on the client side.

Is it feasible? Does anyone have another, more efficient way, of doing
this?

Thanks,
 
It's certainly possible to achieve this on the client side, but not using
server-side controls and properties (such as "visible"). Since you aren't
willing to do a roundtrip to the server (postback), you'll need to use
javascript. I use something like that on my own webpage, it's pretty
straightforward (assuming you know some javascript and DOM) so feel free to
take a look. The "Books" tabs in the bottom right uses it (the rest does
round trips to the server). If you scroll down to the source you'll see the
tabs, the contains and the content, along with the SetContent javascript
call

http://openmymind.net/
http://openmymind.net/script.js

Cheers,
Karl
 
I would question why you want to do everything within a single postback
with no interaction with the server. Do you not require any calls to a
database during this process? Do you not need to get any information
from the server or network while the user is going through the wizard's
steps?

If you're going to do this on the client side with a single postback
then I'm not really sure it would be particularly beneficial for you to
construct the page with user controls. You could instead put all of
the controls on the page and place controls for each step inside a div
block whose style would be set to display:inline; or display:none;
depending on whether it was the active step or not.

Bill E.
 
Back
Top