..


Sponsored Links

Use and management of generic controls

The development of a web application in Visual Studio is very similar to that of a desktop application development tool because with this we should not spend much time writing complex code that is generated automatically instead of using visual tools. To learn how to use Visual Studio the best thing is to develop a simple web page that uses server-side controls.

So we start Visual Studio and create a new project of type Web Site. We click in the Solution Explorer window, right-click the newly created project and select Add -> New Item. In the dialog box that opens, select Web Form and denominiamolo Default.aspx. Now click on the Design tab, and we are ready to work on our

Visual Studio automatically generates the ASP.NET code on the page. If we click the tab split the designer is divided into two parts, the lower is a graphical representation of the page while the upper is the corresponding ASP.NET code. If we include a sentence at the graphic we will see that Visual Studio will place simultaneously in the ASP.NET code

To change the format of the text is necessary to act on the properties of the page. We select the text, we click the right button on it and select the item Properties. In the Properties window, select the voice side and click on the Style button with three dots (ellipsis). This opens the Modify Style dialog box, through which we can set different properties

We choose a font that we like and its size and height and click OK

We note once again as Visual Studio code translates the settings that we did

Now drag a label on our page from the Toolbox window

In the Properties window on the label in the Text property write just inserted the phrase 'write something'. We will see immediately that both the page and viewing the aspx files are updated

It 'clearly can customize the appearance of the label through the Properties dialog box in a similar way to what was done for the web form.

Let's add a text box next to the label and a dropdownlist in

We click the Edit menu in the Items DropDownListTasks and it will open a window in which to insert the values ​​that the control will present users

each element can be associated with a text (which will be displayed during execution) and a corresponding value.

Finally add a button to our page

We double click on the button and we will see in the Default.aspx.cs file will generate the corresponding Click event

If instead we look at the ASP.NET code generated by Visual Studio as a result of our operations, positioning of the controls we should see something like

that made all of our operations have been translated into graphical code.

If as the last step we want to test your button's click event insert the following code in it

If we start the application now, we insert the text 'ABCDEF' in the textbox, select the item 'Three' in the dropdownlist and click on the button will result in the following

Clearly the purpose of the guide is not to analyze all the characteristics of controls available, would serve as a guide only for this, but to make you imagine the ease with which Visual Studio allows the management and utilization. To investigate the operation of the controls used in this lesson and all other generic controls I invite you to consult the official Microsoft.

Help with Visual Studio ASP.Net
E-Learning
ASP (Advanced) ASP (Advanced)
Full course for creating dynamic Web sites. From 39 €.
ASP.NET (Course) ASP.NET (Course)
Full course for building Web applications from 49 €.
SQL and Database (Course) SQL and Database (Course)
Create and manage relational databases. From 39 €.
Sponsored Links