CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/16/2007 9:36:53 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 9 Views: 113 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
10 Items, 1 Pages 1 |< << Go >> >|
clintonG
Asp.Net User
Wizard ActiveStep or MoveTo method Won't Navigate3/16/2007 9:36:53 PM

0/0

The Wizard is on Step5 and some TextBox validation in Step5 has to be done on the server so I've been thinking I need to use the OnActiveStepChanged event. This server-side validation has to be done on the client too but for now I'm trying to work it out on the server. If the validation test is confirmed the Wizard must continue to display the same step, i.e. Step5 must stay displayed (but another step is always displayed instead).

 Navigating back to Step5 proves my validation code is functioning becuase the Wizard1Label.Text property is changed just as expected.

But the damn step won't stay set to Step5 when trying to use the Next button or when selecting a SideBar DataList item both of which raise the OnActiveStepChanged event.

What can I do to keep Step5 displayed?

public void OnActiveStepChanged(object sender, EventArgs e)
{
    if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.Step5))
    {
        // Correctly Displays: 5
        Page.Title = Wizard1.ActiveStepIndex.ToString();

        if (Step5_EmailTextBox.Text.Length > 0 && Step5_NameTextBox.Text.Length > 0)
        {
// ActiveStepIndex won't keep Step5 active Wizard1.ActiveStepIndex = 5; // MoveTo moves to other steps but won't keep Step5 active Wizard1.MoveTo(this.Step5); Wizard1Label.Text = "Only one TextBox may contain a data entry."; } else { Wizard1Label.Text = "-- or --"; } } }
 



<%= clintonG
boolie
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/19/2007 3:16:08 PM

0/0

try changing this line:

if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.Step5))
to:
if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.Step6))
OR 
if that doesn't do the trick, try going back one step then forward to the current step (i know this is not ideal, but it might help to isolate what's going on)
ex: 
Change Wizard1.ActiveStepIndex = 5;
to: 
Wizard1.ActiveStepIndex--; 
Wizard1.ActiveStepIndex++; 
 
see if that works for you.
 
 
Communication is the thin line between what is said and what is heard.
clintonG
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/19/2007 4:42:30 PM

0/0

boolie:

try changing this line:

if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.Step5))
to:
if (Wizard1.ActiveStepIndex == Wizard1.WizardSteps.IndexOf(this.Step6))
 



Odd but I didn't get mail notifying me of your response boolie but good thing 
I decided to review the forums today because your insight proved useful and
Step5 now stays stuck! Thanks boolie...

<%= clintonG
boolie
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/19/2007 7:43:48 PM

0/0

glad i could help!

Communication is the thin line between what is said and what is heard.
clintonG
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/19/2007 11:37:51 PM

0/0

Well, I spoke too soon :-( This issue is not really resolved yet and when all is said and done about the last change that produced desired results those results are not replicable nor have I figured out how to apply to the scope of all of the steps that must be tested to determine they are -- not -- the step which must remain current. Then... I also have a second step that has the exact same circumstances (two textboxes) and this second instance of a step must also be made to remain current when both textboxes contain data. Sigh... back to work...
<%= clintonG
boolie
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/20/2007 12:57:13 PM

0/0

one thing to keep in mind when dealing with the ActiveStep is that once the next button is clicked you are now on the next step.  what i do is usually just plug a simple switch statement in that tests the ActiveStep index.  if it's 1, then i do XYZ; if it's 2, then i do ABC, etc.  can you post more of your code -- the parts where you're testing the next step with the two textboxes?  i went through all of this about 9 months ago writing a security app for my company.  i'm sure we can figure it out together.

Communication is the thin line between what is said and what is heard.
clintonG
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/21/2007 5:23:40 PM

0/0

Thanks for the offer boolie. This task is somewhat convoluted as you've learned so any help working it out will be appreciated. So before I start dumping code I'll discuss the way I see my requirements and setup some terminology to assist our discussion clarifying for the benefit of others who may find this topic to help them understand the context...

** 20 DataList items in the SideBar (indexed 0-19).
The explicit selection of an item in the SideBar is referred to as SideBarX or SideBarY which coincides with the Wizard's StepX and StepY terminology. When using the explicit term StepX or StepY we will be referring to the actual ActiveStepIndex, e.g. Step5 equates to ActiveStepIndex = 5 which is the index value when SideBar5 item is selected or made active by some other process.

** Previous Button
When the previous button is selected the ActiveStepIndex value does not neccessarily change incrementally. For example, a user may select SideBar5 do something in that step and then select SideBar9 from the SideBar list. If the Previous button is then selected SideBar5 will be made active -- not -- SideBar8 which is the step "incrementally previous" to SideBar9.

The converse is also true. If the user starts on SideBar9 and then selects SideBar5 if the Previous button is then selected the move is forward to SideBar9. So selecting the Previous button makes the previous step active no matter the actual index value.

** Next Button
When the Next button is selected the steps increment as expected; Step5 (ActiveStepIndex = 5), selecting Next moves to Step6 (ActiveStepIndex = 6), selecting Next moves to Step 7 (ActiveStepIndex = 7) and so on. The Previous button will move back incrementally in this context.

My Specific Requirements:

Both Step5 and Step6 require using a pair of TextBoxes in each step. However only one TextBox in each step may submit data. The objective is to validate this requirement. By default, a label in each step displays text (-- or --). If both TextBoxes in the step contain data the step must remain actively displayed and the default text of the label must be changed to display text indicating an error has occurred.

I've presumed using the OnActiveStepChanged event is the best event handler to begin trapping for validation. I've used several variants of code including the following snippet of a switch statement...here's what I have as of today...

1    // OnActiveStepChanged Event handler
2    switch (Wizard1.ActiveStep.ID)
3    {
4        ...
5        ...
6       case "Step4":
7          // Previous button may have been selected 
8          // or user may have selected SideBar4 
9          // so validate Step5 and Step6...
10           ValidateTextBoxSteps();
11           break;
12       ...
13       ...
14       case "Step5":
15           // need another method for this step
16           break;
17       case "Step6":
18           // need another method for this step
19           break;
20       case "Step7":
21         // Previous button may have been selected 
22         // or user may have selected SideBar7 
23         // so validate Step5 and Step6...
24           ValidateTextBoxSteps();
25           break;
26       ...
27       ...
28       default:
29       break;
30   }// switch
31   
32   protected void ValidateTextBoxSteps()
33   {
34       if (Step5_Email.Text.Length > 0 && Step5_Name.Text.Length > 0)
35       {
36           Step5_ValidationLabel.Text = "error message";
37           Wizard1.ActiveStepIndex = 5;
38       }
39       else if (Step6_Email.Text.Length > 0 && Step6_Name.Text.Length > 0)
40       {
41           Step6_ValidationLabel.Text = "error message";
42           Wizard1.ActiveStepIndex = 6;
43       }
44       else
45       {
46           Step5_ValidationLabel.Text = "-- or --";
47       }
48   
49   }//protected void ValidateTextBoxSteps()
 

This approach was working out but I busted in late last night and wanted to get back here to get started...more later...

 


<%= clintonG
clintonG
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/22/2007 3:55:54 AM

0/0

I think I finally have it all worked out. The code I posted was lame and still needed a lot of work. I'll do some final testing and post the results here for posterity.
<%= clintonG
boolie
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/22/2007 1:19:08 PM

0/0

Great!  I'm curious as to what ended up being the solution.

Communication is the thin line between what is said and what is heard.
clintonG
Asp.Net User
Re: Wizard ActiveStep or MoveTo method Won't Navigate3/22/2007 5:42:27 PM

0/0

OBJECTIVE:

A Wizard control often needs two TextBoxes on specific steps. In this instance both Step5 and Step6 each require two TextBoxes in each step, that is, each step requires a TextBox to optionally collect an e-mail address and another TextBox to optionally collect a user name. Note however in this instance only one TextBox in each step may be used to submit data. Thus, the current step must remain displayed and an error message must be shown when both TextBoxes in a step contain data. 

Step5 and Step6 each contain a label which is used to display default text (-- or --). When an error occurs the default label text is changed to display an error message (blah blah). There is no either-or group control validator so custom validation code must be written [1]. Compiler anomalies required creative use of branching logic statements [2].
 
1    // By Wizard1 OnActiveStepChanged event handler...
2    switch (Wizard1.ActiveStep.ID)
3    {
4       case "Step0":
5            ValidateSelectedSideBarListItems( );
6            break;
7        ...
8        ...
9        case "Step5":
10           ValidateSelectedSideBarListItems( );
11           break;
12       case "Step6":
13           ValidateSelectedSideBarListItems( );
14           break;
15       ...
16       ...
17       case "Step18":
18           ValidateSelectedSideBarListItems( );
19           break;
20      default:
21           ValidateSelectedSideBarListItems( );
22           break;
23   }//switch (Wizard1.ActiveStep.ID)

1    protected void ValidateSelectedSideBarListItems( )
2    {
3        if (Step5_EmailTextBox.Text.Length > 0 && Step5_NameTextBox.Text.Length > 0)
4        {
5            Step5_ValidationLabel.Text = "error message";
6            Wizard1.ActiveStepIndex    = 5;
7        }
8        else if (Step6_EmailTextBox.Text.Length > 0 && Step6_NameTextBox.Text.Length > 0)
9        {
10           Step6_ValidationLabel.Text = "error message";
11           Wizard1.ActiveStepIndex    = 6;
12       }
13       else
14       {
15           if (String.IsNullOrEmpty(Step5_EmailTextBox.Text.ToString( ))
16           ||  String.IsNullOrEmpty(Step5_NameTextBox.Text.ToString( )))
17           {
18               Step5_ValidationLabel.Text = "-- or --";
19           }
20           if (String.IsNullOrEmpty(Step6_EmailTextBox.Text.ToString( ))
21           ||  String.IsNullOrEmpty(Step6_NameTextBox.Text.ToString( )))
22           {
23               Step6_ValidationLabel.Text = "-- or --";
24           }
25       }
26   } //ValidateSelectedSideBarListItems( )

[1] By default the Wizard will PostBack each time the active step is changed so writing validation code on the server is usually a good place to start. Note to VB developers: I left my VB days behind by choosing to adopt C# which is syntactically exactly the same as JavaScript and it has become much easier and more efficient for me to write or otherwise replicate validation and other code on the client where -- ideally -- this particular type of validation should be done to avoid redundant trips to the server when an error of this type may occur. Starting validation on the server also ensures quality if JavaScript has been disabled in the browser.

[2] In the last "else" block of the ValidateSelectedSideBarListItems( ) method the String.IsNullOrEmpty method is used to avoid logical errors when using || (or) to compare values. Similarly, in the same "else" block the use of two branches of "if"  were required. The use of an "else" would not allow the error messages to be reset for both TextBoxes.


<%= clintonG
10 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Wizard ActiveStep or MoveTo method Won't Navigate - .NET Mar 17, 2007 ... Wizard ActiveStep or MoveTo method Won't Navigate. Get answers to your questions in our .NET forum.
.NET Page 10 - Bytes Site Map Access databases can not be used in VS 2005 · Win XP will not boot without CD · VS 2005 & Vista · Wizard ActiveStep or MoveTo method Won't Navigate ...
Wizard ActiveStep or MoveTo method Won't Navigate - ASP.NET Forums Wizard ActiveStep or MoveTo method Won't Navigate. Last post 03-22-2007 1:42 PM by clintonG. 9 replies. Sort Posts: ...
Firebird Membership/Role/Profile Example Continued | Codemuch Thus we check the ActiveStep to make sure its the CompleteStep which is the ... move to using more proprietary methods and controls to meet their needs. ...
Website Navigation ActiveStep.Title %>.

. . ...... The only limitation in the AddChildren() method is that it doesn’t attempt to ...
Web-Based Wizards: Avoiding Duplicate Data Entry As you move from one step to another in the Wizard, the events listed in the preceding ... the user can’t navigate back to the step. The user can navigate ...
Firebird and ASP.NET 2.0 Thus we check the ActiveStep to make sure its the CompleteStep which is the ...... BillingTitle and BillingDesc work exactly the same so I won't go over ...
dharmendra Yasdav MSTC Certification Asp Net 2 0 asp.net 2.0 +wizard +headertemplate +inline +activestep +title ...... The DataRow object doesn’t have an undelete method, but you can use the RejectChanges ...
(Exam 70-528) Microsoft .NET Framework 2.0 Web-Based Client ... NET 2.0 The Wizard control is new in ASP.NET version 2.0. ...... The DataRow object doesn’t have an undelete method, but you can use the RejectChanges ...
PRADO v3.1.1 Quickstart Tutorial Unidirectional - Users can navigate forward along a sequence of wizard steps. ...... Ok, so we’ll move on to looking at our methods that actually get called ...




Search This Site:










problem creating sitemapnode for use in custom sitemapprovider

menu control populated by a sitemapdatasource

how to include scripts in master pages

changing the placement of nodes in treeview

sitemenu and breadcrumbs

menu navigation control overlapping with text labels - need help, please

masterpages and server side forms

how to check the child node when the parent node is checked in treeview

disable direct url of a page in address bar of internet explorer in asp.net

problem with menu webcontrol

parser error in web with multi themes

change contents of a master page depending on user logon information

lose reference to strongly types masterpage

using session from master page in content page

create webpage with sitemap data

unable to find control id 'textbox1' referenced by the 'controltovalidate' property of 'requiredfieldvalidator1'.

is there a online page or something to let designer adjust skin?

how to call content page's "sub page_load" from masterpage?

web.sitemap

how to map sub domain and sub folders with themes (asp.net 2.0)

sitemap trimming not happening

using drop down list to programatically change themes

need help converting existing page to content page

treeview, direct link to a node: how to?

dynamic "page last updated" date

menu forecolor doesnot work

adding css link tags

how to create templates

need help with the dynamic menu in vs2005

sitemap: how to add a click event handler to a node?

  Privacy | Contact Us
All Times Are GMT