Solved

hide wizard control buttons C#

Posted on 2006-11-09
7
824 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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