Sunday, September 27, 2015

CREATING WEB FORMS IN ASP WEB APPLICATION



INTRODUCTION TO ASP WEB FORMS

ASP Web Forms is a part of the ASP.NET web application framework and is included with Visual Studio. It is one of the four programming models you can use to create ASP.NET web applications

Web Forms are pages that your users request using their browser. These pages can be written using a combination of HTML, client-script, server controls, and server code. When users request a page, it is compiled and executed on the server by the framework, and then the framework generates the HTML markup that the browser can render. An ASP.NET Web Forms page presents information to the user in any browser or client device.

Using Visual Studio, you can create ASP.NET Web Forms. The Visual Studio Integrated Development Environment (IDE) lets you drag and drop server controls to lay out your Web Forms page. You can then easily set properties, methods, and events for controls on the page or for the page itself. These properties, methods, and events are used to define the web page's behavior, look and feel, and so on. To write server code to handle the logic for the page, you can use a .NET language like Visual Basic or C#.

ASP.NET Web Forms are:

 Based on Microsoft ASP.NET technology, in which code that runs on the server dynamically generates Web page output to the browser or client device.
  • Compatible with any browser or mobile device. An ASP.NET Web page automatically renders the correct browser-compliant HTML for features such as styles, layout, and so on.
  • Compatible with any language supported by the .NET common language runtime, such as Microsoft Visual Basic and Microsoft Visual C#.
  • Built on the Microsoft .NET Framework. This provides all the benefits of the framework, including a managed environment, type safety, and inheritance
  • Flexible because you can add user-create and third party controls to them.


Adding Web Form in a web application

Following are the steps to add web form in web application:



Step1: Open Microsoft Visual Studio 2010(IDE) and file menu on IDE
 

 



Step2: Create a website application in IDE with C#. Give the name of the website in the bottom of given pop-up menu and then click on Ok button. After add a new empty website and then right side in IDE open Solution Explorer and right click




Step3: Select the option Add New Item open a dialog box and select the Web Form click on add button
Give the name of the Web Form in the bottom of given pop-up menu and then click on Ok button







Step4: On left side in IDE, Open Toolbox. Drag and Drop the tools in Web Form’s Design Page and then rename the tool   


Introducing Controls in ASP Web Application

Drag and drop the tool “Label “from toolbox in Web Form’s Design Page 


Drag and drop the tool “TextBox“from toolbox in Web Form’s Design Page


Drag and drop the tool “RadioButtonList“from toolbox in Web Form’s Design Page. Right Click the RadioButton and Click Properties. In the Properties window, Add Sub Items in “Items” field


Drag and drop the tool “DropDownList“from toolbox in Web Form’s Design Page. Right Click the DropDownList and Click Properties. In the Properties window, Add Sub Items in “Items” field


Drag and drop the tool “CheckBoxList“from toolbox in Web Form’s Design Page. Right Click the CheckBoxList and Click Properties. In the Properties window, Add Sub Items in “Items” field


Drag and drop the tool “ListBox“from toolbox in Web Form’s Design Page. Right Click the ListBox tool and Click Properties. In the Properties window, Add Sub Items in “Items” field







Drag and drop the tool “FileUpload“from toolbox in Web Form’s Design Page 



Drag and drop the tool “Button “from toolbox in Web Form’s Design Page


Drag and drop the tool “LinkButton “from toolbox in Web Form’s Design Page and Click Properties. In the Properties window, Select PostBackUrl field as redirecting web form page and Click Ok button


Create New folder “images” Copy and Paste any image to New folder “images” Drag and drop the tool “LinkButton “from toolbox in Web Form’s Design Page and Click Properties. In the Properties window,Select ImagUrl as copied image path, also set an appropriate  width and height for that image