UNIT1.pptx Introduction to ASP.NET IN IMR COLLEGE JALGOAN

dnyandip40 13 views 41 slides Jun 24, 2024
Slide 1
Slide 1 of 41
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41

About This Presentation

UNIT1.pptx Introduction to ASP.NET IN IMR COLLEGE JALGOAN


Slide Content

Unit I Application and Page Frameworks , Asp .Net Server Controls and Client Side Scripts, Asp .Net Web Server Controls., Validation Server Control, Working with Master Pages, Themes and Skins.

Introduction to ASP.NET ASP stands for  A ctive  S erver  P ages ASP is a development framework for building web pages. ASP and ASP.NET are server side technologies. Both technologies enable computer code to be executed by an Internet server.

When a browser requests an ASP or ASP.NET file, the ASP engine reads the file, executes any code in the file, and returns the result to the browser. ASP.NET pages have the extension  . aspx  and are normally written in C# (C sharp). An ASP.NET file is just the same as an HTML file An ASP.NET file can contain HTML, XML (extensible markup language), and scripts An ASP.NET file has the file extension ". aspx "

The Microsoft .NET Framework The .NET Framework is an environment for building, deploying, and running Web applications and Web Services. Microsoft's first server technology ASP (Active Server Pages), was a powerful and flexible "programming language". But it was too code oriented. It was not an application framework and not an enterprise development tool.

The Microsoft .NET Framework was developed to solve this problem. ASP.NET Frameworks keywords: Easier and quicker programming Reduced amount of code Declarative programming model Richer server control hierarchy with events Larger class library Better support for development tools

What is the Difference between ASP and ASP.NET ? ASP ASP.Net i.  It has limited oops support and not having built in support for xml. i .  ASP.NET is full featured object oriented programming. ii.  Very less development and debugging tool available. Meaning that difficult to debug the code. ii.  It has full support of xml( extensible markup language) . Which helps easy data exchange. iii.  ASP you can only do scripting using visual basic scripting and java scripting. iii.  Various tools and compiler available. Microsoft Visual studio makes your debugging job easier. iv.  Error handling is very poor. iv.  ASP.NET we can use either C# or VB.NET as server side programming language. v.  It has no high level programming structure. Mixed of html and server side scripting. v.  Error handling is very good. vii.  It has no in built validation control. Meaning that validating page is difficult for developers. vi.  It has state management support.

Web Forms Controls In ASP.NET Asp.net is Fully Based on Controls . Before Making any application If you will understand the Use of Controls then you can easily make any Application without any problem in Asp.Net . There are some Types of controls which are used in Asp.Net . Web Forms Standard controls. Navigation Controls Validation Controls Web Parts controls Html Controls

we will understand one by one each Controls with Real Application. Whenever you will use  Web Forms Controls   in your Application then First write one  Namespace   Which is Given below: using System.Web.UI.WebControls ;

Web Forms Controls :- There are some Web Forms Controls which is given below with Real Time Example:- Label Control TextBox control Button control Image control ………

Label Control :- The Label Control is basically used to display the Information(Text) on Web Forms . Any end User can not Edit(change) the Label Information. < asp:Label ID="Label1" runat =" server Text ="Label"></ asp:Label > Properties of Label Control :- here are some important properties of Label controls. Text :-It is used to change the Label control information(text). Font :- It is used to sets the font of the Label text. ForeColor :- It is used to sets the text color in the Label. Height :- It is used to Specify the height of the Label Control. BackColor  :-It is used to Sets the Background color of the Label control.

TextBox Control :- The TextBox control is used to input the Data(text).Any end user can easily enter the text in this control. < asp:TextBox ID=" TextBox1“ runat ="server"></ asp:TextBox > Properties of TextBox Control :- There are some important properties of TextBox controls. Text :-It is used to sets the text in TextBox Control. TextMode :- It is used to sets the mode of the TextBox Control as Single Mode,Multiline or Password. Rows :-It is used to sets the number of rows display in a TextBox (Multiline).

Button Control : The Button control is used to create an Event and send request to the web server. < asp:Button ID="Button1" runat ="server" Text="Button" /> Properties of Button Control :- There are some important properties of Button controls. Text :- It is used to sets the text to be displayed on the Button Control. Click :-It is an Event that occurs when the Button is clicked. OnClientClick :-It is used to sets the client side script that executes when a Button click event is fired.

Image Control :-  It is used to display an image on a web page. < asp:Image ID="Image1" runat ="server" /> Properties of Image control :- There are some important properties of Image control controls. Alternate Text :- It is used to display alternate text when the image is not present. ImageAlign :-It is used to sets the alignment of image control on the web page. ImageUrl :-It is used to sets the path to an image to display in  the image control. Font :-It is used to increase or decrease font of the image control text. DescriptionUrl :-It is used to set the location to a detailed description for the image.

Validation Controls in ASP.NET An important aspect of creating ASP.NET Web pages for user input is to be able to check that the information users enter is valid. ASP.NET provides a set of validation controls that provide an easy-to-use but powerful way to check for errors and, if necessary, display messages to the user. There are six types of validation controls in ASP.NET RequiredFieldValidation Control CompareValidator Control RangeValidator Control RegularExpressionValidator Control CustomValidator Control ValidationSummary

RequiredFieldValidator Server Control: The RequiredFieldValidator control is simple validation control, which checks to see if the data is entered for the input control .  It is a simple validation control, but it is one of the most frequently used . < asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat ="server" Text="Required!" ControlToValidate ="TextBox1" > </ asp:RequiredFieldValidator > Example: ?

CompareValidator Control The CompareValidator control allows you to make comparison to compare data entered in an input control with a constant value or a value in a different control. < asp:CompareValidator ID="CompareValidator1" Runat ="server" Text="Passwords do not match!" ControlToValidate ="TextBox2" ControlToCompare ="TextBox1" ></ asp:CompareValidator >

RangeValidator Control The RangeValidator Server Control is another validator control, which checks to see if a control value is within a valid range. The attributes that are necessary to this control are: MaximumValue , MinimumValue , and Type. < asp:RangeValidator ID="RangeValidator1" Runat ="server" ControlToValidate ="TextBox1" Type="Integer" Text="You must be between 30 and 40" MaximumValue =" 40“MinimumValue ="30" ></ asp:RangeValidator > Example:??

RegularExpressionValidator Control A regular expression is a powerful pattern matching language that can be used to identify simple and complex characters sequence that would otherwise require writing code to perform.

CustomValidator Server Control The CustomValidator control allows you to build your own client-side or server-side validations that can then be easily applied to your Web forms . Example:??

ValidationSummary Displays a report of all validation errors occurred in a Web page < asp:ValidationSummary ID="ValidationSummary1" Runat ="server" HeaderText ="You received the following errors:" > </ asp:ValidationSummary >

Practical 1 Create and ASP .NET application using Web server controls apply appropriate validation to it.

Navigation Control in ASP.NET Navigation controls are very important for websites. Navigation controls are basically used to navigate the user through webpage . It is more helpful for making the navigation of pages easier .There  are three controls in ASP.NET ,Which are used for Navigation on the webpage. TreeView control Menu Control SiteMapPath control

There are some  Namespaces,  which are used for above Navigation controls which are given below: Using.System.Web.UI.WebControls.TreeView ; Using.System.Web.UI.WebControls.Menu ; Using.System.Web.UI.WebControls.SiteMapPath ;

The  TreeView Control : - The TreeView control is used for logically displaying the data in a hierarchical structure. We can use this navigation control for displaying the files and folders on the webpage.   < asp:TreeView runat ="server" DataSourceId ="nav1" />

Menu Control :- The menu control is a Navigation control , which is used to display the site navigation information This can be used to display the site data structure vertically and horizontally. <asp:Menu runat="server"DataSourceId="nav1" />

SiteMapPath Control : The SiteMapPath control is also used to display the Navigation information on the site. It display the current page's context within the entire structure of a website.

Master Pages? ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages (or a group of pages) in your application. You can then create individual content pages that contain the content you want to display.

When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. A master page is an ASP.NET file with the extension .master Master Page Default.aspx Content page MC Combined Page Default.aspx

Themes and Skin A theme decides the look and feel of the website. It is a collection of files that define the looks of a page. It can include skin files, CSS files & images . How to apply themes Setting the theme at the page level: the Theme attribute is added to the page directive of the page.  <%@ Page Language="C#"  AutoEventWireup ="true"  CodeFile =" Default.aspx.cs"Inherits ="Default" Theme="Theme1"%>

Since themes can contain CSS files, images and skins, you can change colors, fonts, positioning and images simply by applying the desired themes.

Skin File ASP.Net skins can only be used to apply the styles to  the ASP.Net controls . Skins can be used to apply the common style to the individual  ASP.Net controls. You can apply a style to the specific control. It easy to remind which skin is for which control because inside the skin file ASP.Net controls are directly used and in . aspx pages it automatically appears to that control id style.

When you use an ASP.Net Skin you need to add a Skinfile.skin file under the ASP.Net theme folder.

Ad Rotator  Control The  AdRotator  Web server control reads advertisement (ad) information from a data source, which one or more ad records. You can store ad information in an XML file and then bind the  AdRotator  control to the file. < asp:AdRotator ID="AdRotator1" runat ="server" AdvertisementFile ="~/XMLFile.xml" />

<Advertisements> <Ad> < ImageUrl > </ ImageUrl > < NavigateUrl > </ NavigateUrl > < AlternateText > </ AlternateText > <Impressions> </Impressions> </Ad> <Ad> < ImageUrl >~/IMG/download (3).jpg</ ImageUrl > < NavigateUrl >~/Samsung.aspx</ NavigateUrl > < AlternateText >Samsung</ AlternateText > <Impressions>3</Impressions> </Ad> </Advertisements>

All attributes of the  AdRotator  control are optional. The following attributes can be included in the XML files: ImageUrl    The URL of the image to display. NavigateUrl    The URL of the page to go to when the  AdRotator  control is clicked. AlternateText    The text to display if the image is unavailable. Keyword    The category of the ad, which can be used to filter for specific ads.

Impressions    A numeric value (a weighting number) that indicates the likelihood of how often the ad is displayed. Height    The height of the ad in pixels.  Width    The width of the ad in pixels.

Calendar control:- Calendar control provides you lots of property and events. By using these properties and events you can perform the following task with calendar control. Select date. Selecting a day, a week or a month.