Ask your technical questions on forums or here :
ASP.NET or MVC | C# | Windows Phone
Microsoft Technology Journals by Abhimanyu K Vatsa
Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

29 Nov 2015

Upload video on YouTube in ASP.NET or MVC

In this post you will learn how to upload video on YouTube from your application. I’ve used ASP.NET Web Forms as well as MVC bits to implement all functionality easily. You can achieve similar functionality ASP.NET Web Forms or MVC alone.

2 Apr 2015

Disable Browser Back Button

In this quick code you will learn how to disable browser back button. As this is a client side solution, I would never suggest to use when it comes to confidential websites like banking sector.

31 Mar 2015

Query string values in JavaScript

In this quick code you will learn how to get query string (browser address bar's variable) values using JavaScript.

15 Jan 2015

Technical reviewer of Microsoft TypeScript

The very nice people at PACKT Publication recently asked me to technical review one of the upcoming new book TypeScript, and you know I never miss such opportunities to review book and become its part. Greedily, to get reviewer name printed on book gives great feel.

23 Jan 2014

Display Images and its name, size before uploading to server by using FileReader - JavaScript File API

If you look at my previous post Single File Upload to Multiple File Upload, it display size of the file after upload.

10 Sep 2013

Mustache.js - Getting Started with Mustache.js in MVC: Video

In this video post you will learn how to use Mustache.js JavaScript library in MVC for client side templating.

9 Sep 2013

Getting Started with Mustache.js in MVC

In this post you will learn how to use Mustache.js JavaScript library in MVC for client side templating.  I will take you through few easy steps to setup it and working.

2 Oct 2012

TypeScript: JavaScript like Programming Language by Microsoft

Okay, here is a great news, Microsoft has released a developer preview of TypeScript, a new programming language like JavaScript that is translated into JavaScript so that its apps can be run in any browser. In other words, TypeScript is a superset of JavaScript and you write it like you write JavaScript. And today, I explored it and I am sharing it with you.

5 Aug 2012

Best Practices for Speeding up Your Web Site

The Exceptional Performance team has identified a number of best practices for making web pages fast. The list includes 35 best practices:

3 Aug 2012

Bundling and Minification in Visual Studio 2012 or Migrate existing Website

Bundling and minification are two new techniques introduced with ASP.NET 4.5 Beta to improve request load time.  It improves load time by reducing the number of requests to the server and reducing the size of requested assets (such as CSS and JavaScript).

26 Jul 2012

How to get Selected ListBox Item using JavaScript

This is a quick post in response to a question asked by my one of the follower on Facebook and the answer is pretty simple.

Here is the question I have been asked:-

23 Jul 2012

Stop form Submission (Posting) on Enter Key Press

This is a quick hit post. If you are developing a form in ASP.NET you may be noticed that when we press enter key even without writing any information in textboxes, form gets post (submitted). So, how do you stop it?

24 May 2012

Making Clone on Web Page using jQuery


This post shows how to make the clone of elements on web page using jQuery, for this we will use .clone() method.

Sometimes we want to copy (clone) elements on web page, for example, navigate menu can be placed on header and footer too and there may be many situations come to us where we need to clone. Why write something twice if we have opportunity to use jQuery.

So, let's create a demonstration page for this talk.

    <h2>History of Visual Studio</h2>
    <div class="mainBody">
        Visual Studio's history probably begins in <strong class="year">1975</strong> with Bill and Paul's decision to create Altair BASIC.  Maybe you could start before that but I think that's as far back as you could go and still say it's about Visual Studio at all – it's at that time that Microsoft decided it was going to have software development products and not, say, toaster automation.
        Some informations.
        Some more informations.

Let's assume; we want to copy the 'mainBody' <div> and place it after first <p>. To do this we will use following jQuery:


Above jQuery, making the clone of <div> that has class 'mainBody' and inserting this new clone after first <p>, in DOM 0 refers the very first <p>, 1 refers the second <p> and so on.

Output in Browser:

Take one more assumption; what if we want to apply different style to cloned copy?

Now, to do this we need to create a style class.

    <style type="text/css">
        .cloneStyle {
            background: #ead3d3;
            font: italic 1.4em "Times New Roman", Times, serif;

So, we have a style now; let's add it to cloned copy.


Nothing new here, just added one more attribute .addClass('cloneStyle') to existing jQuery above.

Now, look at the output in browser:

So, that's all about the making clone on web page. You can dive deep in this topic to achieve some more functionality.

23 May 2012

JavaScript OnLoad() and OnUnload() Methods

Using OnLoad()

 <title>JavaScript Popup</title>
<script type="text/javascript">
function poponload()
    testwindow ="", "mywindow", "location=1,status=1,scrollbars=1,width=300,height=300");
    testwindow.moveTo(0, 0);
<body onload="javascript: poponload()">
<h1>JavaScript Popup</h1>

Using OnUnload()

 <title>JavaScript Popup</title>
<script type="text/javascript">
function exitpop()
    my_window ="", "mywindow1", "status=1,width=300,height=200");
    my_window.document.write('<h1>Popup Example</h1>');
<body onunload="javascript: exitpop()" >
<h1>JavaScript Popup Example 4</h1>