330 likes | 751 Views
Web Programming. Building ASP.NET Applications. T. Ahlam Algharasi 4 th Level . The Visual Studio IDE. Start page. Websites in Visual Studio. Create a new ASP.NET application. Websites in Visual Studio. The New Web Site window. Websites in Visual Studio.
E N D
Web Programming Building ASP.NET Applications T. AhlamAlgharasi 4th Level
The Visual Studio IDE • Start page
Websites in Visual Studio • Create a new ASP.NET application.
Websites in Visual Studio • The New Web Site window
Websites in Visual Studio • The New Web Site window allows you to specify three details: • Template: The template determines what files your website starts with. Visual Studio supports two types of basic ASP.NET applications: web site applications and web service applications. • Location: The location specifies where the website files will be stored. • Language: The language identifies the .NET programming language you’ll use to code your website.
The Visual Studio IDE 2 1 3 4
Solution Explorer • It allows you to see the files that are in the web application directory. • ASP.NET File Types
Solution Explorer • ASP.NET File Types
Solution Explorer • “App_Data” Folder • This directory is reserved for data storage, including database files , XML files, and other data store files. Of course, you’re free to store data files in other directories.
Toolbox Tabs • You can customize both the tabs and the items in each tab. • To modify the tab groups, right-click a tab heading, and select Rename Tab, Add Tab, or Delete Tab. • To add an item, right-click the blank space on the Toolbox, and Select Items. You can also drag items from one tab group to another.
Code Debugging • To test this page, select Debug ➤Start Debugging from the menu. Because this is the first time running any page in this application, Visual Studio will inform you that you need a configuration file that specifically enables debugging • Click OK to add this configuration file. ASP.net Server
The Coding Model • Visual Studio supports two models for coding web pages and web services: • Code-behind • This model separates each ASP.NET web page into two files: an .aspx markup file with the HTML and control tags, and a .vb code file with the source code for the page. • This model provides better organization • important when building complex pages.
The Coding Model • Code-behind Example • “Default.aspx” Page
The Coding Model • Code-behind Example • “Default.aspx.vb” Page
The Coding Model • Inline code • This model is the closest to traditional ASP. All the code and HTML is stored in a single .aspx file. The code is embedded in one or more script blocks. • it’s popular for coding simple web pages.
The Coding Model • Inline code Example
Choosing the coding model • When you add a new web page to your website (using Website ➤Add New Item), the Place Code in a Separate File check box chooses whether you want to use the code-behind model or not.
Web Forms • The term used to describe an ASP.NET web page is web form. • The basic structure of a web form is shown here:
Server Controls • Server controls • are a fundamental part of the ASP.NET architecture. • are tags that are understood by the server. • There are three kinds of server controls: • HTML Server Controls - Traditional HTML tags • Web Server Controls - New ASP.NET tags • Validation Controls - For input validation
Server Controls • HTML Server Controls • HTML server controls are standard HTML tags and they are declared with the runat="server" attribute. • The runat="server" attribute indicates that the form should be processed on the server.
Server Controls • Web Server Controls • These classes duplicate the functionalities of the basic HTML tags but have a more consistent and meaningful set of properties and methods that make it easier for the developer to declare and access them.
Server Controls • Validation Controls • are used to validate user-input. For Example If the user-input does not pass validation, it will display an error message to the user.