C# ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT WPF
C# OOPS HTML&CSS DHTML ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT MVVM WPF SQL SERVER Photoshop Dreamweaver Flash Illustrator
Blog Archive
-
2012
(83)
- September(2)
-
August(81)
- Important WPF Classes and Namespaces
- Applications of WPF
- Programming With WPF
- Limitations of Silverlight and flash
- Silverlight Feature comparison with Flash Features
- How to Add XML File in Your Silverlight Project
- 3 Pixel Shader Effects in Silverlight
- Rotate Image in 3D direction using Silverlight
- First Application of Silverlight
- Silverlight 2.0
- How Install Ajax?
- Ajax Advantage
- JavaScript Loops
- Show a Military Clock and ordinary clock
- How To validate a Form in ASP. Net
- How to show Day of Week
- How to Swap a Image using JavaScript
- Special Character in JavaScript
- Prompt Box in JavaScript
- The use of data adapter.?
- The steps involved to fill a dataset?
- Dataset object in ADO .NET
- Handling Connection Events
- The SQLCONNECTION OBJECT
- Command Constructors
- The SQLCOMMAND OBJECT
- Gridview in ASP.NET
- Introduction Of Master Page
- Server Side State Management
- Query String In ASP.NET
- Cookies in ASP.NET
- State Management in ASP.NET
- Various types of application that we can develop i...
- Properties
- Inheritance ,Polymorphism
- Array,Indexer and Collections
- Control Statements
- Operators, types and variables in C#
- Fundamental of C#
- C# & other Programming Languages
- The WPF Designer
- C# DataTypes
- What is Ajax?
- Silverlight 1.0
- Confirm Box in JavaScript
- Component classes
- Life Cycle of ASP.NET
- The Basics of JQuery
- Jquery Blog Content
- Birth Of WPF
- .Net Frameworks Architecture
- History Of Ajax
- Why Silverlight?
- How to access a URL of parent page in ASP. net
- THE ADO.NET Architecture?
- Architecture of ASP.NET
- Introduction Of Ajax
- Ajax Blog Content
- Introduction of SilverLight
- Silverlight Blog Content
- Introduction to Javascript Blog
- Javascript Blog Content
- Introduction to Ado.Net blog
- Ado.Net Blog Content
- Introduction to C# Blog
- C# Blog Content
- Introduction to Asp.Net
- Asp.Net Blog Content
- Introduction to WPF
- WPF Blog Content
- WPF Interview Question
- Silverlight Interview Question
- Ajax Interview Question
- JQuery Interview Question
- Javascript Interview Question
- DHTML Interview Question
- Ado.Net Inetview Questions
- SQL Interview Questions
- HTML&CSS Interview Questions
- Asp.Net Interview Qusetions
- C# Interview Questions
Important WPF Classes and Namespaces
Some Important WPF Classes and Namespaces
Before working with WPF you need to know some common classes and interfaces and their uses. So in this chapter you will get a clear understanding of different classes and interfaces and there uses. Before knowing the classes and namespaces you need to know, what are the base assemblies that provide different classes ad interfaces for a WPF application. WPF has three base assemblies. These are as below,
- WindowsBase.dll: This assembly defines the core types that constitute the infrastructure WPF API.
- PresentationCore.dll: As the name specifies this assembly specifies different types for WPF GUI layer.
- PresentationFoundation.dll: It defines the WPF control types, animation, multimedia and data binding support. It also specifies some other functionality.
- The above three namespaces are managed namespaces. Besides these three namespaces WPF also uses an unmanaged library, i.e. milcore.dll. This library is responsible to work with DirectX layer. It acts as a bridge between the managed WPF assemblies and the DirectX layer.
Some WPF Classes:
All these three assemblies provides a number of new namespaces and hundreds of new .NET types(classes, interfaces, structures, enumerations and delegates) to work with WPF. The following class diagram and the class’s functionality.
![]() |
- DispatcherObject: It is an abstract base class for classes that are bound to one thread. Classes that are derived from DispatcherObject have an associated Dispatcher object that can be used to switch the threads.
- Application:
In every
WPF application, one instance of Application class is created. This class
implements a singleton pattern for access to the window of application,
resources and properties. See the below image.

- DependencyObject: It is the base class for all the classes that supports Dependency property.
- Visual: It is the base class for all the visual elements of WPF. This class includes features for transformation.
- UIElement: It is the abstract base class for all WPF elements that need basic presentation feature. This class provides evens such as mouse move, drag and drop, click, etc.
- FrameworkElement: It is derived from base class UIElements and implements the default behaviour of the methods defined by the base class.
- Shape: Shape is the base class for all the shape elements such as, line, rectangle, ellipse, polygon.
- Control: It is derived from FrameworkElement and is the base class for all the user-interactive elements.
- Panel: As the name suggest it is the abstract base class for all the panels and is derived from FrameworkElement. Panel class has a Children property for all the UI-Element that is inside a panel and defines methods for arranging the child controls. Panel defines different classes to define the behaviour of child controls such as, WrapPanel, StackPanel, Grid and Canvas.
- ContentControl: - It is the base class for all the controls that have a single content such as, Buttons, Labels, CheckBox, RadioButton, etc.
You can also find the class hierarchy of your application using Object
Browser in VS 2008. To view Object Browser go to view menu and select
Object Browser. Object Browser also contains all the namespaces and its classes.
See the below image for WPF class hierarchy. It is the class hierarchy of a
simple WPF application that we have created earlier. Using Object Browser you
can find all the methods, properties and events of a particular class by
selecting that class.

Some WPF Namespaces:
- System. Windows:- It is the core namespace of WPF. You will find all the base classes such as, Application, DependencyObject , DependencyProperty and FrameworkElement here.
- System. Windows. Controls:- This namespaces contains all the controls of WPF. You will also find classes to work with complex controls such as PopUp, ScrollBar, StatusBar, TabPanel, etc. as well as all the basic controls.
- System. Windows. Data:- This namespace is used by WPF for Data Binding.
- System. Windows. Input:- This namespace provides several classes for command handling, keyboard input, etc.
- System. Windows. Markup:- This namespace helper classes for XAML markup code.
- System. Windows. Media:- This namespace is responsible to work with images, audio, and multimedia.
- System. Windows. Shapes:- This namespace provides core classes for UI such as Line, Rectangle, Ellipse, etc.
- System. Windows. Threading:- This namespace provides classes to work with multiple threads.
- System. Windows. Navigation:- This namespace provides classes for navigation between WPF pages particularly when working with Web Applications.
Applications of WPF
Applications of WPF
WPF has comprehensive features for creating user experiences with rich content. To package this content and deliver it to users as "applications," WPF provides types and services that are collectively known as the application model. The application model supports the development of both standalone and browser-hosted applications.
Standalone Applications
For standalone applications, you can use the
Window class to create windows and dialog boxes that are accessed from menu bars
and tool bars.
Additionally, you can use the following WPF dialog boxes: MessageBox, OpenFileDialog, SaveFileDialog, and PrintDialog.
Like in below image-
Browser-Hosted Applications
For browser-hosted applications, known as XAML
browser applications (XBAPs), you can create pages (Page) and page functions
(PageFunction<T>) that you can navigate between using hyperlinks (Hyperlink
classes).
For Browser-Hosted Application we will discuss later.
Now we are starting with Standalone Application.
Controls in Windows WPF-
The built-in WPF controls are listed here.
Buttons: Button and
RepeatButton.
Dialog Boxes: OpenFileDialog,
PrintDialog, and SaveFileDialog.
Digital Ink: InkCanvas and
InkPresenter.
Documents: DocumentViewer,
FlowDocumentPageViewer, FlowDocumentReader, FlowDocumentScrollViewer, and
StickyNoteControl.
Input: TextBox, RichTextBox, and
PasswordBox.
Layout: Border, BulletDecorator,
Canvas, DockPanel, Expander, Grid, GridView, GridSplitter, GroupBox, Panel,
ResizeGrip, Separator, ScrollBar, ScrollViewer, StackPanel, Thumb, Viewbox,
VirtualizingStackPanel, Window, and WrapPanel.
Media: Image, MediaElement, and
SoundPlayerAction.
Menus: ContextMenu, Menu, and ToolBar.
Navigation: Frame, Hyperlink, Page,
NavigationWindow, and TabControl.
Selection: CheckBox, ComboBox,
ListBox, TreeView, RadioButton, and Slider.
User Information: AccessText, Label,
Popup, ProgressBar, StatusBar, TextBlock, and ToolTip.
Programming With WPF
Programming With WPF
The fundamental of WPF
programming is very familiar to the Windows and web Application. You can
instantiate classes, set properties, call methods, and handle events, all using
your favorite .NET Framework programming language, such as C# or Visual Basic.
WPF exists as a subset of .NET Framework types that are for the most part
located in the System.Windows namespace.
WPF includes additional programming constructs that enhance properties and
events: Dependency Properties and Routed Events
Markup and Code-Behind
WPF offers additional programming enhancements for Windows client application development. One obvious enhancement is the ability to develop an application using both markup and code-behind, an experience that ASP.NET developers should be familiar with. Development and maintenance costs are reduced because appearance-specific markup is not tightly coupled with behavior-specific code.
Development is more efficient because
designers can implement an application's appearance simultaneously with
developers who are implementing the application's behavior.
Multiple design tools can be used to implement and share XAML markup, to target
the requirements of the application development contributors.
Globalization and localization for WPF applications is greatly simplified
Markup
XAML is an XML-based markup language that is used to implement an application's appearance declaratively. It is typically used to create windows, dialog boxes, pages, and user controls, and to fill them with controls, shapes, and graphics.
Code-Behind
The main behavior of an application is to implement the functionality that responds to user interactions, including handling events (for example, clicking a menu, tool bar, or button) and calling business logic and data access logic in response. In WPF, this behavior is generally implemented in code that is associated with markup. This type of code is known as code-behind.
To understand Code behind i have taken example for Button click event to show the message box. For this just double click on Button you will go to the code behind of button and write the code as follows for button click event.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
// Show message box when button is clicked
MessageBox.Show("Welcome to WPF Programming!");
}
}
}
|
Limitations of Silverlight and flash
Limitations of Silverlight and flash
|
Silverlight |
Flash |
|
| Now, we got moonlight for Linux user | This limitation doesn’t exist with Flash. | |
| Silverlight will (naturally) be using the WMV and Silverlight will add to the use of the WMV file format. | Flash Video turned Flash into a mechanism for delivering media with far more potential than any other solution that is .flv. | |
| Now, we are able to read the data from web services (including RESTful service), XML from URL. Silverlight 2 supports Socket communication too. | Even flash is also lacking this area. Flash can read data source in terms of XML or text from some URL and can use it. Same thing silverlight also can read. | |
| The standard controls are included in Silverlight 2 beta1. | Flash has rich set of control library. | |
| Once the accessibility features are provided with Silverlight versions, any existing test tools that support driving UI through Accessibility will be fully enabled to automate Silverlight applications | Flash test tools are already in place. | |
| Silverlight 1.0 does not support GIF-file format. | Support all image formats. | |
| Webcam and Microphone support it not there. | Flash supports it. | |
| Built in file upload/download support is not available. | Inbuilt Upload/download support is there. | |
| The performance of Silverlight and Flash will be nearly the same. While Silverlight is using XAML as description language in a non-compressed format size of Silverlight component is large.In practical implementation of similar component in Flash and Silverlight it has found that size of Silverlight component is approximately 10-20 times larger than Flash component. | Size of flash component is smaller. | |
| We got .xap now. but there are a number of people who like to get XAML with managed code. (SL 1.1 Alpha style) | Flash ships in single component that is .swf. Images/video/sounds also incorporated in single .swf package. | |
| Silverlight 2 supports Socket communication too. | Flash allows creating XML Socket object. | |
| It has found in practical implementation of image animation, at some extent flickering occurs on image. | To avoid this type of flickering in flash, refresh layout or cache bitmap functionalities are available. | |
| It has found in practical implementation of video play, audio may start playing before showing movie on screen. It has also found video can still continue to play after redirecting to other page. It may be it is bug of current beta release. | Flash doesn’t face these types of issues. | |
| XPF or XBAP is already there for that. | Flash can be played as Windows application also by downloading player for it. Flash can be also packaged as .exe which can be deploying standalone. | |
| Silverlight is new in market and required time to get acceptance in market. | Flash is exist from many years and have strong acceptance in market. | |
| Can’t do sound processing. | With some media file sound processing can possible. | |
Silverlight Feature comparison with Flash Features
Silverlight Feature comparison with Flash Features
|
Silverllight |
Flash |
| Animation - Silverlight supports the WPF animation model, which is not only time based instead of frame based, but lets you define the start and end conditions and it will figure out how to get there for you. No need to deal with matrixes like in flash. Also no need to calculate positions on various frames. It just works. | The animation model is frame based. |
| Silverlight uses XAML. XAML is text based and can be output using a simple XML object. | Flash stores its shapes using binary shape records. In order to write shape definitions, you will need to either license a 3rd party Flash file format SDK, or build your own. It isn’t too difficult, but it does require a bit of a learning curve. |
| The debugging with Silverlight is simpler than with flash. | The debugging with flash is harder than Silverlight. |
| Silverlight lets you embed true type font information directly into your projects, and download that information with the web client object. Downloader is no longer available but we have web client. | Dealing with fonts is fairly complex with flash. |
| XAML is declarative while ActionScript is imperative. Using imperative languages to build UIs goes back to the early days of DOS and Windows, when developers had to manage all of the API nuances when interacting with graphical panes. | ActionScript is an imperative language, which brings itself the pitfalls of imperative languages when compared with declarative languages. |
| Additional Support for mobile devices with desktop and desktop browsers:Silverlight is supported by Windows mobile device as part of a new service that the NBL have built. Silverlight applications and media streaming can be run on a mobile phone - so Silverlight even at this stage is about more than just the desktop browser and desktop market. Silverlight may be seen soon on the Symbian OS too. | Flash is not spread as across the vast majority of both desktops and mobiles platforms, as compared to Silverlight. Flash requires Flash Lite preinstalled on mobile devices. |
| Silverlight does not require video codec to run industry standard videos like .WMV | Flash requires video codec to run .WMV videos. |
| Silverlight supports scalable video formats from HD to mobile. | Flash does not support scalable video formats from HD to mobile |
| Silverlight supports Hardware-assisted editing and encoding solutions. | Flash does not support Hardware-assisted editing and encoding solutions. |
| Silverlight provides End-to-end server and application platform. | Flash does not provide End-to-end server and application platform. |
| Media server licensing is cheaper than flash. | Media server licensing is costier than Silverlight. |
| Silverlight supports Scalable full screen video. | Flash does not support Scalable full screen video. |
How to Add XML File in Your Silverlight Project
How to Add XML File in Your Silverlight Project
Add Xml File named as Employee.xml and write the code given below

.XAML Code: Write this code in MainPage.xaml
<UserControl x:Class="SilverlightApplication14.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<ListBox x:Name="EmployeeList" Width="400" Height="200"
SelectionChanged="EmployeeList_SelectionChanged" />
</Grid>
</UserControl>
|
.CS Code: Write this code in MainPage.xaml.cs page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml;
namespace SilverlightApplication14
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
PopulateEmployeeList();
}
private void PopulateEmployeeList()
{
XmlReader reader = XmlReader.Create("Employee.xml");
reader.MoveToContent();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name
|
Run the Silverlight Application

3 Pixel Shader Effects in Silverlight
3 Pixel Shader Effects in Silverlight
Write below code in your MainPage.xaml
<UserControl x:Class="SilverlightApplication14.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="8" Grid.Column="0">
<TextBlock Text="(Hi, Dear) A Drop Shadow!" FontSize="20">
<TextBlock.Effect>
<DropShadowEffect />
</TextBlock.Effect></TextBlock>
<TextBlock Text="(Helloooo) A Slight Drop Shadow!" FontSize="20">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="2" />
</TextBlock.Effect></TextBlock>
<TextBlock Text="(Good Bye) Blur Effect!" FontSize="20">
<TextBlock.Effect><BlurEffect />
</TextBlock.Effect></TextBlock>
</StackPanel></Grid></UserControl>
|
The Design page shown like

Run the Silverlight Application

Rotate Image in 3D direction using Silverlight
Rotate Image in 3D direction using Silverlight
Add Three ToggelButton and an image in your Project

Write below code in your MainPage.xaml.
<UserControl x:Class="SilverlightApplication14.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources><Storyboard x:Name="RotateZStoryBoard">
<DoubleAnimation Storyboard.TargetName="rotation"
Storyboard.TargetProperty="RotationZ" From="0.0" To="360.0" Duration="0:0:10"
|
The Design shown like:

MainPge.xaml.cs Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml;
namespace SilverlightApplication14
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void rotateX_Click(object sender, RoutedEventArgs e)
{
if (rotateX.IsChecked.Value)
{
RotateXStoryBoard.Begin();
}
else
{
RotateXStoryBoard.Stop();
}
}
private void rotateY_Click(object sender, RoutedEventArgs e)
{
if (rotateY.IsChecked.Value)
{
RotateYStoryBoard.Begin();
}
else
{
RotateYStoryBoard.Stop();
}
}
private void rotateZ_Click(object sender, RoutedEventArgs e)
{
if (rotateZ.IsChecked.Value)
{
RotateZStoryBoard.Begin();
}
else
{
RotateZStoryBoard.Stop();
}
}
}
}
|
Run Your Silverlight Aplication (Click on Rotate Z-Axis)

First Application of Silverlight
Step 1: Open a New Project.

Step 2: Select a Silverlight Application and press OK

Step 3: At beginning we take a example of Canvas Control. Drag a canvas control and TextBlock control from ToolBox. you can move these as your choice.

Design Code:
<UserControl x:Class="SilverlightApplication8.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Canvas x:Name="canvas1">
<TextBlock Canvas.Left="10" Canvas.Top="10" Height="23" Name="textBlock1"
|
Step 4: Run the application

Silverlight 2.0
Silverlight 2.0
Silverlight 2.0 includes a version of the .NET Framework, with the full Common Language Runtime as .NET Framework 3.0; so it can execute any .NET language including VB.NET and C# code. Unlike the CLR included with .NET Framework, multiple instances of the CoreCLR included in Silverlight can be hosted in one process. With this, the XAML layout markup file (.xaml file) can be augmented by code-behind code, written in any .NET language, which contains the programming logic.
This version ships with more than 30 UI
controls(including TextBox, CheckBox, Slider, ScrollViewer, and Calendar
controls), for two-way databinding support, automated layout management (by
means of StackPanel, Grid etc) as well as data-manipulation controls, such as
DataGrid and ListBox. UI controls are skinnable using a template-based approach.
Main features of Silverlight 2.0
- A built-in CLR engine that delivers a super high performance execution environment for the browser.
- Silverlight uses the same core CLR engine that we ship with the full .NET Framework.
- Silverlight includes a rich framework library of built-in classes that you can use to develop browser-based applications.
- Silverlight includes support for a WPF UI programming model. The Silverlight 1.1 Alpha enables you to program your UI with managed code/event handlers, and supports the ability to define and use encapsulated UI controls.
- Silverlight provides a managed HTML DOM API that enables you to program the HTML of a browser using any .NET language.
- Silverlight doesn't require ASP.NET to be used on the backend web-server (meaning you could use Silverlight with with PHP on Linux if you wanted to).
- Silverlight 2 includes Deep Zoom, a technology derived from Microsoft Live Labs Seadragon. It allows users to zoom into, or out of, an image (or a collage of images), with smooth transitions, using the mouse wheel. The images can scale from 2 or 3 megapixels in resolution into the gigapixel range, but the user need not wait for it to be downloaded entirely; rather, Silverlight downloads only the parts in view, optimized for the zoom level being viewed.
- Silverlight 2 also allows limited filesystem access to Silverlight applications. It can use the operating system's native file dialog box to browse to any file (to which the user has access).
How Install Ajax?
In this section you will learn how you can install Ajax in eclipse 3.2 or in ASP.net .
For Eclipse jMaki is Plugin to install this plugin for the Eclipse 3.2 or Eclipse 3.3 we have follow following steps
1. Start Eclipse 3.3.X or Eclipse 3.2.X (The WTP (Web Tools Platform) plugins must be installed.)
2. Start the installation procedure : Go to Help>Software Updates>Find and Install in menu item.
3. Select "Search for new features to install" option and click Next.
4. Click "New Remote Site".
5. Enter a name (ie jMaki Eclipse Plugin ), enter the URL https://ajax.dev.java.net/eclipse
6. Select this new site in the Sites to include in search list and click Next.
7. Select jMaki for Eclipse in the "Select the features to install" list and click Finish.
8. Accept the terms of the license agreements and click Next.
9. Verify that the install location is your Eclipse installation directory, otherwise select the correct one, click Finish.
10. A warning will appear telling the feature is not signed. Ignore and click Install to continue.
11. Accept to restart the workbench to load jMaki into the workbench.
After Eclipse is restarted the plugin is correctly installed if you see the jMaki widgets in the Eclipse Snippets view.
If this does not work.Then you can do menauly .Download the plugin the jars file from https://ajax.dev.java.net/eclipse/plugins/org.jvnet.ajax.eclipse.jmaki_1.8.0.jar
Operating Systems
Windows Server 2003
Windows XP Home Edition
Windows XP Professional
Windows Vista
Any Windows operating system version (including Windows 2000) that supports the Microsoft .NET Framework version 2.0. Note that support will be limited to the terms of support for that platform.
Required Software
.NET Framework 2.0 or version 3.0.
I E 5.01 +
Optional Software
Microsoft Visual Studio 2005 or Visual Web Developer Express Edition
Installing Microsoft ASP.NET AJAX
Steps to install ASP.NET AJAX.
Ajax Advantage
Q : What is Ajax Advantage?
AJAX web applications are browser and platform independent.The web applications in AJAX supported by all major browsers.But it support only IE 5.0+, Safari 1.2+, Mozilla 1.0+ / Firefox, Opera 8+, and Netscape 7+.
AJAX is used to make a better Internet Applications(web applications).
Ajax web base applications are easier to install and support, and easier to develop.
With AJAX, Internet applications(Web applications) can be made richer and more user-friendly.
AJAX Uses HTTP Requests . In traditional JavaScript if we want to get informations from a server (from database or a file ), or user have send information to a server. Then we will have to make an HTML form .Which will send data to server through GET or POST method. The user will have to click on "Submit" button to send/get the information.This mean we have send whole data of form and we have wait for the server to respond results.Then the server sends a new page as a results. This mean there is refresh of page.Because the server returns a new page each time the user submits input. So the traditional web applications was slower and tend to be less user-friendly. With object of XMLHttpRequest we can communicates directly with the server and with HTTP request, a web page can make a request to, and get a response from a web server - without reloading the page.
JavaScript Loops
JavaScript Loops
The for Loop
How many times the script should run then we used for loop.
Syntax
for (variable=startvalue;variable<=endvalue;variable=variable+increment)
{
//code
}
|
The while Loop
The while loop loops through a block of code while a specified condition is
true.
Syntax
while (variable<=endvalue)
{
//code
}
|
Example:
Step 1. Written below code in your application.
<html>
<body>
<script type="text/javascript">
var i=0;
for (i=0;i<=10;i++)
{
document.write("The number is " + i);
document.write("<br />");
}
</script>
</body>
</html>
|
Step 2. Run the Application. Click on Button.

Show a Military Clock and ordinary clock
Show a Military Clock and ordinary clock
Step 1. Written below code in your application.
<html>
<SCRIPT>
var now;
function showMilitaryTime() {
if (document.theForm.showMilitary[0].checked) {
return true;
}
return false;
}
function showTheHours(theHour) {
if (showMilitaryTime() || (theHour > 0 && theHour < 13)) {
return (theHour);
}
if (theHour == 0) {
return (12);
}
return (theHour - 12);
}
function showZeroFilled(inValue) {
if (inValue > 9) {
return ":" + inValue;
}
return ":0" + inValue;
}
function showAmPm() {
if (showMilitaryTime()) {
return ("");
}
if (now.getHours() < 12) {
return (" am");
}
return (" pm");
}
function showTheTime() {
now = new Date();
document.theForm.showTime.value =
showTheHours(now.getHours()) +
showZeroFilled(now.getMinutes()) +
showZeroFilled(now.getSeconds()) +
showAmPm();
setTimeout("showTheTime()", 1000);
}
</SCRIPT>
<BODY onLoad="showTheTime();">
<FORM NAME="theForm">
<INPUT TYPE="TEXT" NAME="showTime">
Display Military Time?
<INPUT TYPE="RADIO" NAME="showMilitary" CHECKED>Yes
<INPUT TYPE="RADIO" NAME="showMilitary">No
</FORM>
</html>
|
Step 2. Run the Application. Click on Button.

How To validate a Form in ASP. Net
How To validate a Form in ASP. Net
Step 1. Written below code in your application.
JavaScript Code
<script language="javascript" type="text/javascript">
function validate()
{
if (document.getElementById("<%=TextBox1.ClientID%>").value=="")
{
alert("Name can not be blank");
document.getElementById("<%=TextBox1.ClientID%>").focus();
return false;
}
if(document.getElementById("<%=TextBox2.ClientID %>").value=="")
{
alert("Email id can not be blank");
document.getElementById("<%=TextBox2.ClientID %>").focus();
return false;
}
var emailPat= /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var emailid=document.getElementById("<%=TextBox2.ClientID %>").value;
var matchArray = emailid.match(emailPat);
if (matchArray == null)
{
alert("Your email address seems incorrect. Please try again.");
document.getElementById("<%=TextBox2.ClientID %>").focus();
return false;
}
if (document.getElementById("<%=TextBox3.ClientID%>").value=="")
{
alert("Contact Number can not be blank");
document.getElementById("<%=TextBox3.ClientID%>").focus();
return false;
}
var digits="0123456789";
var temp;
for (var i=0;i<document.getElementById("<%=TextBox3.ClientID %>").value.
|
Default.aspx Code
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Form Validation</title>
</head>
<body>
<form id="form1" runat="server">
<script language="javascript">
//Write JavaScript Code
</script>
<div>
<table >
<tr><td>Name</td>
<td><asp:TextBox ID="TextBox1" runat="server"
Width="193px"></asp:TextBox></td></tr>
<tr> <td>Email ID</td>
<td><asp:TextBox ID="TextBox2" runat="server" Width="193px"
ToolTip="Enter unique Email ID" AutoPostBack="True">
</asp:TextBox></td></tr>
<tr><td>Contact Number</td><td>
<asp:TextBox ID="TextBox3" runat="server" Width="193px"
AutoPostBack="True"></asp:TextBox></td></tr>
<tr><td> Sex</td>
<td><asp:RadioButton ID="RadioButton1" runat="server" Text="Male"
|
Step 2. Run the Application. Click on Button.











