Solved

hide wizard control buttons C#

Posted on 2006-11-09
7
818 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now