Solved

hide wizard control buttons C#

Posted on 2006-11-09
7
823 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

20 Experts available now in Live!

Get 1:1 Help Now