ASP.NET - Example
ASP.NET - Example
When we finished our First Example, our web app should look like below
When we enter our Name in Text Box and click OK button ,the program should respond with a greetings.
Step 1 :
To create web application in visual studio 2017 click File->New->Project
In Installed menu select Visual C#->Web->Asp.Net Web Application
In next screen choose Webforms->click ok
Step 2 :
Now to add a new webform make a right click ,project name in Solution Explorer as shown below, Make a click on Web Form, Press Add button
After adding webform, we will have the following window
In the above window make a click On Design page, From the Tool Box
Drag three label box and one text box and one command button, Design the page as shown below
In the Properties Window change the properties of each controls as follows
Name of the Control
Properties Change
Label1
Text: Enter your Name
Label2
Text: This is my first ASP.NET Web Form App
Button1
Text: OK
TextBox1
Label3
After designing the form, if we make a click on Source page it will look like as shown below,
We don’t need to write any code, automatically it will be created if we click an drag the controls
Step 3 :
Now make a click on OK button, it will prompt to coding window as shown below, Add the following code: Label1.Text = "Hello," + TextBox1.Text;
Step 4 :
To run the application, Press f5
Now if I enter readexpert.com in the Textbox, we will get the output as shown above. we have created our first ASP.NET Web Forms application.