C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Create a New Web FormHere, we are using the project that we created in last topic. To add a new web form in our existing project, first select project then right click and add new item. Select web forms option in left corner and then select web form and hit add button. Now click on the add button and this form will add to our project. After adding form, we can see that this is now in our project as we have shown in the below image. Double click on this form and this will show some auto generated code like this: // user-form.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user-form.aspx.cs" Inherits="asp.netexample.user_form" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html> If we run this file on the browser, it does not show any output. So, let's print some message by this form. The modified code is as below. // user-form.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user-form.aspx.cs" Inherits="asp.netexample.user_form" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <h2>Welcome to the Web Forms!</h2> </div> </form> </body> </html> After running it on the browser it yields the following output. Apart from this message, we can do lots and add controls to this page as well. We will add controls to form in our next chapters.
Next TopicASP.NET Server Controls
|