Search This Blog

Jul 29, 2012

What is jQuery?

What is jQuery and explain basics about JQuery

This article will explains JQuery and also familiarize about JQuery like what is advantage of using JQuery and why to use it in web application.

What is JQuery?What is JQuery?

It is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.

What you can do with JQuery?

In summary JQuery is smart javascript library which allows you to do complex javascript code in a minute. It has also capability of performing AJAX Operations. Here are Few examples of Jquery usage in real life application

Example 1: You can use JQuery to show tooltip on textbox focus.

Example 2: You can perform Photo Corp using JQuery

Example 3: You can fill cascading dropdown using Ajax JQuery In Below example, When you select country, it will fill state/region drop-down and when you select state/region, it will cities based on values in database using JQuery Ajax web service call.

Example 4: JQuery Homepage slider, which is very common now a days on many websites homepage.

Example 5: Autocomplete JQuery Textbox.

And the example list goes on and on.

  • You can do various effects with JQuery
  • You can have all controls like Ajax Control toolkit with JQuery UI
  • You can use various third party plugins to do various stuff and much more...

What is use of JQuery?

What is use of JQuery?

Advantages of using JQuery in web application?

1. It Improve the performance of the web application
2. It is light weight
3. Its language independent - It can be use with many different language, eg: Asp.Net, PHP, HTML, JSP,etc
4. It is browser compatible - Runs in most browser.
5. It is easy to learn - it uses javascript syntax.
6. You can do complex UI functionality with few lines of code.
7. You can implement ajax within your web application.  It can be used to avoid round trip (avoid page post back) yet able to perform database operation.
8. It is open source library, which is also officially integrated in visual studio 2010.
9. You will find lot of JQuery functionality shared other developers, which helps you to avoid in reinventing the wheel.
And much more...

Where to download JQuery? If you want you can avoid downloading JQuery file and simply use from CDN (Content distribution network) link for google CDN

Tips: While adding JQuery try using min version (Example: jquery-1.6.2.min.js), which is less file size, since space and line break are removed from that. This will help in faster loading of file and also improves performance of web application.

How to use JQuery in Web Application?

Creating your first Hello World application in JQuery

Step 1: Open Visual Studio

Step 2: Create a new web application project (Web site...)

Step 3: Open master page of your web application. Put this line of code, above </head> <script type="text/javascript" language="Javascript" src=""></script>

Above line adds JQuery library reference to your web application, in simple terms with above line you web application understands JQuery syntax and work accordingly.

Step 4: Put following line of code in you content page inside <asp:Content>. Below line will display "Hello World" alert when page loads. <script language="javascript" type="text/javascript">
$(document).ready(function () {
alert("Hello World");

Understanding $(document).ready(function ()

if you want an JQuery event to work on your page, you should call it inside the $(document).ready() function. Everything inside it will load as soon as the DOM is loaded and before the page contents are loaded.

$(document) - means page on which JQuery code lies. .ready() - means page is loaded and your JQuery code is ready to be executed.

And for that reason you may find that most of JQuery code lies within

<script language="javascript" type="text/javascript">
$(document).ready(function () {



So finally you will be able to display alert on page load in your web application with JQuery.

May be this question might comes to your mind, I can show "Hello World" alert without using JQuery then what is fun of using JQuery? Well its too early to judge, since this article is for beginners i have explained with simple example there is lot more coming. Please refer to my other upcoming JQuery tutorials.

Jul 28, 2012

Exploring the IDE

The best way to familiarize yourself with some of the features of VS .NET is to have a hands-on tour. Visual Studio has a very substantial feature set, however, there are many features of Visual Studio that are commonly used and offer a great productivity boost if used effectively. This section aims to introduce those common items.

Starting Up

Perform the following steps to create a new Web project:

  • Start VS .NET.
  • Click New Project in the Get Started section of the Visual Studio Start Page. The New Project dialog box appears.
  • Click the Visual Basic Projects folder in the left pane of the New Project dialog box.
  • Click the ASP.NET Web Application icon in the Templates window.
  • Click OK.

Design View

Once you’ve created a new project, Visual Studio should look similar to Figure, depending on the settings in the My Profile section of the Visual Studio Start Page.

You can think of this page designer as analogous to the Form Designer in traditional VB—it is an empty canvas where you build the user interface (UI) by dragging and dropping components onto it. In this sense it is very much the same as the Form Designer, although there are several differences. Web pages do not have specific boundaries like those that can be given to forms, so that they can’t be resized to be larger or smaller.

Because Web applications are viewed in Web browsers, the page can be manipulated in any way that Web browsers can manipulate any other Web page. This is a very significant point, and it is one of the more difficult concepts that needs to be properly understood in the tradition between developing traditional Windows applications and Web applications.

The Design view is technically a WYSIWYG editor (“What You See Is What You Get,” which holds true for the Form Designer in Visual Basic). A control you place on a form will appear in exactly the same place and have exactly the same dimensions as it will when the application is run. Unfortunately, it can often be the case that what you see in the Web Forms Designer is not what you get when you view the page in the browser.

More often that not, the problem is related to the dimensions of the page—the distances used in the page make it look great in Design view, but when you see it in a browser (which will likely have a much larger viewing area), the distances look completely out of proportion. To add insult to injury, there is no OnResize event that is triggered when the browser is resized, so the page cannot be dynamically redrawn appropriately every time the user resizes the browser. For this reason, the use of HTML tables is crucial in maintaining correct distances, as tables allow specific dimensions to be specified for the entire table, as well as rows and columns.

Design considerations aside (as they apply to all Web pages, not only those developed using the Web Forms Designer), Design view offers a fairly powerful and easy-to-use UI designer. All Web Forms in Visual Studio have two files by default: one to hold the content and another to hold the server-side logic code. The Visual Studio designer ensures that appropriate entries are made in both files when controls are added to the Web Form. This is a major timesaver and relieves much annoyance, as it is very easy to forget to add appropriate entries to the logic code file if an entry is made in the UI file manually.

Common Type System (CTS)

The CLI specification defines a rich type system that far surpasses COM's capabilities. It's called the Common Type System (CTS). The CTS defines at the runtime level how types are declared and used. Previously, language compilers controlled the creation and usage of types, including their layout in memory. This led to problems when a component written in one language tried to pass data to a component written in a different language. Anyone who has written Visual Basic 6 code to call Windows API functions, for instance, or who has tried to pass a JavaScript array to a component written either in Visual Basic 6 or C++, is aware of this problem. It was up to the developer to translate the data to be understandable to the receiving component. The CTS obliterates this problem by providing the following features:

  • Primitive types (Integer, String, etc.) are defined at the runtime level. Components can easily pass instances of primitive types between each other because they all agree on how that data is formatted.
  • Complex types (structures, classes, enumerations, etc.) are constructed in a way that is defined at the runtime level. Components can easily pass instances of complex types between each other because they all agree on how complex types are constructed from primitive types.
  • All types carry rich type information with them, meaning that a component that is handed an object can find out the definition of the type of which the object is an instance. This is analogous to type libraries in COM, but the CTS is different because the type information is much richer and is guaranteed to be present.

Portions of the CLI

The CLI specification recognizes that the CLR can't be implemented to the same extent on all platforms. For example, the version of the CLR implemented on a cell phone won't be as versatile as the one implemented on Windows 2000 or Windows XP. To address this issue, the CLI defines a set of libraries. Each library contains a set of classes that implement a certain portion of the CLI's functionality. Further, the CLI defines profiles. A profile is a set of libraries that must be implemented on a given platform.

The libraries defined by the CLI are:

Runtime Infrastructure Library

This library provides the core services that are needed to compile and run an application that targets the CLI.

Base Class Library

This library provides the runtime services that are needed by most modern programming languages. Among other things, the primitive data types are defined in this library.

Network Library

This library provides simple networking services.

Reflection Library

This library provides the ability to examine type information at runtime and to invoke members of types by supplying the member name at runtime, rather than at compile time.

XML Library

This library provides a simple XML parser.

Floating Point Library

This library provides support for floating point types and operations.

Extended Array Library

This library provides support for multidimensional arrays.

The profiles defined by the CLI at this time are:

Kernel Profile

This profile defines the minimal functionality of any system claimed as an implementation of the CLI. CLRs that conform to the Kernel Profile must implement the Base Class Library and the Runtime Infrastructure Library.

Compact Profile

This profile includes the functionality of the Kernel Profile, plus the Network Library, the Reflection Library, and the XML Library. It is intended that an implementation of the Compact Profile can be lightweight, yet provide enough functionality to be useful.

Additional profiles will be defined in future versions of the CLI specification. Any given implementation of the CLI is free to implement more than the functionality specified by these minimal profiles. For example, a given implementation could support the Compact Profile but also support the Floating Point Library. The .NET Framework on Windows 2000 supports all the CLI libraries, plus additional libraries not defined by the CLI.

Note that the CLI does not include such major class libraries as Windows Forms, ASP.NET, and ADO.NET. These are Microsoft-specific class libraries for developing applications on Windows platforms. Applications that depend on these libraries will not be portable to other implementations of the CLI unless Microsoft makes those class libraries available on those other implementations.

.Net Framework

In the ASP/VB6 model, Microsoft had developers building a component and then calling it via an ASP. Microsoft realized that it would be a good idea to make the component directly callable over HTTP, so that an application anywhere in the world could use that component. Microsoft threw their support behind SOAP, Simple Object Access Protocol, which allows developers to call a component over HTTP using an XML string, with the data returning via HTTP in an XML string. Components sport URLs, making them as easy to access as any other Web item. SOAP has the advantage of having been a cross-industry standard, and not just a Microsoft creation.

.NET provides you with integrated debugging tools. If you've ever debugged an ASP application that had VB COM components, you know that you had to use Visual InterDev to debug the ASPs and VB to debug the components. If you also had C++ components in the mix, you had to use the C++ debugger on those components. With .NET, there is one debugger. Any language that targets the .NET Framework can be debugged with that single debugger, even if one part of your application is written in VB.NET and calls another part written in C# (pronounced C-Sharp), or any other language built to target the .NET Framework.

The .NET Framework is a collection of services and classes. It exists as a layer between the applications you write and the underlying operating system. This is a powerful concept: The .NET Framework need not be a Windows-only solution. The .NET Framework could be moved to any operating system, meaning your .NET applications could be run on any operating system hosting the .NET Framework. This means that you could achieve true cross-platform capabilities simply by creating VB.NET applications, provided the .NET Framework was available for other platforms. Although this promise of cross-platform capability is a strong selling point to .NET, there has not yet been any official announcement about .NET being moved to other operating systems.

One of the major components of the .NET Framework is the Common Language Runtime, or CLR. The CLR provides a number of benefits to the developer, such as exception handling, security, debugging, and versioning, and these benefits are available to any language built for the CLR. This means that the CLR can host a variety of languages, and can offer a common set of tools across those languages.

Microsoft has made VB, C++, and C# premier languages for the CLR, which means that these three languages fully support the CLR. In addition, other vendors have signed up to provide implementations of other languages, such as Perl, Python, and even COBOL.

When a compiler compiles for the CLR, this code is said to be managed code. Managed code is simply code that takes advantage of the services offered by the CLR. For the runtime to work with managed code, that code must contain metadata. This metadata is created during the compilation process by compilers targeting the CLR. The metadata is stored with the compiled code and contains information about the types, members, and references in the code. Among other things, the CLR uses this metadata to

  • Locate classes
  • Load classes
  • Generate native code
  • Provide security

The runtime also handles object lifetimes. Just as COM/COM+ provided reference counting for objects, the CLR manages references to objects and removes them from memory when all the references are gone, through the process known as garbage collection. Although garbage collection actually gives you slightly less control than you had in VB, you gain some important benefits.

For example, your errors should decrease because the number of objects that end up hanging around due to circular references should be reduced or completely eliminated. In addition, garbage collection ends up being much faster than the old way of destroying objects in VB. Instances of objects you create that are managed by the runtime are called managed data. You can interact with both managed and unmanaged data in the same application, although managed data gives you all the benefits of the runtime.

The CLR defines a standard type system to be used by all CLR languages. This means that all CLR languages will have the same size integers and longs, and they will all have the same type of string no more worrying about BStrs and CStrs! This standard type system opens up the door for some powerful language interoperability.

For example, you can pass a reference of a class from one component to another, even if those components are written in different languages. You also can derive a class in C# from a base class written in VB.NET, or any other combination of languages targeted to the runtime. Don't forget that COM had a set of standard types as well, but they were binary standards. This meant that with COM, you had language interoperability at run time. With .NET's type standard, you have language interoperability at design time.

After it is compiled, managed code includes metadata, which contains information about the component itself, and the components used to create the code. The runtime can check to make sure that resources on which you depend are available. The metadata removes the need to store component information in the registry. That means moving a component to a new machine does not require registration, and removing components is as simple as deleting them.

As you can see, the Common Language Runtime provides a number of benefits that are not only new, but should enhance the experience of building applications. Other benefits that you will see in more detail include some of the new object-oriented features to ASP.NET. Many of these new features are not so much additions to the language as they are features of the runtime that are simply being exposed to the ASP.NET.

Related Posts Plugin for WordPress, Blogger...