Solved

hide wizard control buttons C#

Posted on 2006-11-09
7
827 Views
Last Modified: 2012-08-13
I have a wizard control and I need to hide and show the buttons at certain points. Here is what I have tried, but it doesn't work:

private void ShowHideWizardButtons(bool ShowBack, bool ShowNext, bool ShowSaveAndExit)
    {
        ((Button)ProjectWizard.FindControl("StepNavigationTemplateContainerID$StepPreviousButton")).Visible = ShowBack;
        ((Button)ProjectWizard.FindControl("StepNavigationTemplateContainerID$StepNextButton")).Visible = ShowNext;
        ProjectWizard.DisplayCancelButton = ShowSaveAndExit;
    }


private void ShowHideWizardButtons(bool ShowBack, bool ShowNext, bool ShowSaveAndExit)
    {
        ((Button)ProjectWizard.FindControl("StepPreviousButton")).Visible = ShowBack;
        ((Button)ProjectWizard.FindControl("StepNextButton")).Visible = ShowNext;
        ProjectWizard.DisplayCancelButton = ShowSaveAndExit;
    }


Any ideas?
0
Comment
Question by:strickdd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17906334
What is not working?  FindControl?

Bob
0
 
LVL 28

Author Comment

by:strickdd
ID: 17906365
It is not hiding the buttons. The second one says the control doesn't exist.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17906408
The wizard control does a lot of stuff in the background that is not always readily available to override.  Maybe the fact that this doesn't work is because there is code that re shows the button at the wrong time.  A lot of times this is a timing issue, and not always easy to find a solution.

Bob

0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Expert Comment

by:rawlinpa
ID: 17907726
Manually loop through the controls on the page searching for one with ID of the wizard control button and set that to be visible or not
0
 
LVL 28

Author Comment

by:strickdd
ID: 17907732
rawlinpa,
   Do you have any Utilities to do this "FindControl" strategy?
0
 
LVL 1

Accepted Solution

by:
rawlinpa earned 500 total points
ID: 17907764
public static System.Web.UI.Control FindControl(Type ControlType, System.Web.UI.ControlCollection Controls)
{
      for (int counter = 0; counter < Controls.Count; ++counter) // loop through each control in the control collection
      {
            if (Controls[counter].GetType() == ControlType) //see if the current control is a match
            {
                  return Controls[counter];
            }
            else if (Controls[counter].Controls.Count > 0) // check the child controls
            {
                  System.Web.UI.Control FoundControl = FindControl(ControlType, Controls[counter].Controls); // recursive call to check child controls

                  if (FoundControl != null) // control found in child's controls
                  {
                        return FoundControl;
                  }
            }
      }

      return null;
}
0
 
LVL 28

Author Comment

by:strickdd
ID: 17907774
Perfect, I didn't even think of that!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question