How to Add Buttons to Numeric Controllers

Controllers are Visual Studio elements that let you contain buttons and other website controls. You add a button to a controller such as a panel. The panel holds the buttons, so you can place the buttons anywhere on your website. The buttons are grouped, so this type of website programming is beneficial when you have several website elements you want to place in one section of the page. You can add buttons to a controller with a numeric reference using the website code.

Instructions

    • 1

      Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET," then click "Visual Studio." A list of your Web projects appears.

    • 2

      Double-click the Web project with your numeric controllers. All of the project files appear on the right side of the window. Double-click the page that contains your controllers. The page opens to a code file where you type your code to add the buttons.

    • 3

      Scroll down to the code that mentions your controller. A controller element in your code has a name and a numerical index associated with it. For instance, if you have a controller with the name "mycontroller" with an index of one, the following code appears in your website code file:

      mycontroller[1]

    • 4

      Write the code to add a button to the controller. The following code adds a button to a controller:

      Button mybutton = new Button();

      mycontroller[1].Control.Add(mybutton);

    • 5

      Click the "Save" button in your main Visual Studio toolbar, then click "Run." The "Run" button executes the code so that you can review the control and its contained button in the browser.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured