ASP.NET Introduction
- ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites. It allows you to use a full featured programming language such as C# or VB.NET to build web applications easily.
- .NET is a developer platform made up of tools, programming languages, and libraries for building many different types of applications.
- ASP.NET provides Base libraries for working with strings, dates, files/IO, and more.
- When using ASP.NET your back end code, such as business logic and data access, is written using C#.
- We can use the large ecosystem of packages and libraries available to all .NET developers. You can also author your own libraries that are shared between any applications written on the .NET platform.
- ASP.NET apps can be developed and run on Windows, Linux, macOS, etc.
- ASP.Net is designed to work with the HTTP protocol. This is the standard protocol used across all web applications.
ADO.NET Introduction
- ADO.NET is a data access technology from the Microsoft . NET Framework that provides communication between relational and non-relational systems through a common set of components.
- The .NET Framework includes its own data access technology i.e. ADO.NET.
- ADO.NET is a large set of .NET classes that enable us to retrieve and manipulate data, and update data sources, in very many ways.
- ADO.NET consists of managed classes that allows .NET applications to connect to data sources such as Microsoft SQL Server, Microsoft Access, Oracle, XML, etc.
- It uses disconnected data architecture which is easy to scale as it reduces the load on the database. Everything is handled on the client-side, so it improves performance.
- As it uses disconnected data access, applications do not retain database lock connections for a longer time. Thus, it accommodates scalability by encouraging programmers to conserve limited resources and allow users to access data simultaneously.
Creating ASP.NET Application
New -->Project-->In visual C# tab --> Select Web--> Enter project name & Browse location -->Click on OK-->Select empty --> Click on OK
ASP.NET Web Forms
- asp.net web form consist of server controls called as asp.net tags
- All server controls must appear within a form tag, and the form tag must contain the runat="server" attribute.
- The runat="server" attribute indicates that the form should be processed on the server. It also indicates that the enclosed controls can be accessed by server scripts
- An .aspx page can only contain ONE form tag with runat="server" attribute
Web Form Structure
- Frond end file - (.aspx) contains frond end code i.e. html,css,JS etc
- Designer file - (aspx.designer.cs) contains all the definition of the controls that are being used by the page - System generated code
- Code Behind / Back end file - (aspx.cs) Contains all business logic / scripting language code i.e. C# code in asp.net
ASP.NET Web Form Tags
Open web form in design mode then click on view --> Click on toolbox (here you can see all asp.net server tags)
Most used asp tags are
- asp:label
- asp:textbox
- asp:button
- asp:image
- asp:dropdownlist
- asp:checkbox
- asp:linkbutton
- asp:RadioButton
- asp:fileupload
- asp:calendar
- Data Control - asp:gridview
- Data Control -asp:Literal
- Data Control -asp:Repeater etc.
ASP.NET Web Form Attributes
Most used asp attributes are
- CssClass
- ID
- TextMode
- AutoComplete
- AutoPostBack
- Text etc.