Monday, January 28, 2013

Difference between document.ready and window.onload or pageLoad

In Asp.Net Web applications, developers use the jquery’s $document.ready() and pageLoad() or window.onload events very frequently. In the first sight these events seems very similar in functioning. But $document.ready()  and pageLoad() methods are very differ in functioning.

In this post I am trying to expose the difference between $document.ready()  and pageLoad() .

Thursday, January 24, 2013

Difference between Int32.Parse(), Convert.ToInt32() and Int32.TryParse()

Int32.Parse()


Int32.Parse (string s) method converts the string representation of a number to its 32-bit signed integer equivalent. When s is a null reference, it will throw ArgumentNullException. If s is other than integer value, it will throw FormatException. When s represents a number less than MinValue or greater than MaxValue, it will throw OverflowException.

Wednesday, January 23, 2013

Get IP address using C#

Here is I'm trying to get IP address in a web application when it's page load using C#. The following code will help u for getting IP address....

Tuesday, January 22, 2013

Watermark in textbox using JavaScript

In the web application development, developers always try to make UI more user-friendly and interactively. Showing watermark on textbox is one of the tools to increase user-interactivity of website. Most of the sites use the watermark mainly for “Search” functionality. In this post I will show you a simple implementation of watermark in textbox using JavaScript.

Monday, January 21, 2013

Prevent multiple clicks on button

More often programmers need to prevent the multiple clicks on button. We can prevent the multiple clicks just by disable or hide the button after the first click and enable or show it again when the processing in done. We can also show the message at the time of processing to user.Here in the images shown below, I have just show you the scenario before and after the postback.

Saturday, January 19, 2013

How to pass table as parameter in stored procedures in SQL Server (Table-Valued Parameters)

In this post I will explain how to pass table as parameter in stored procedure with example.
Table-Valued Parameters is a new feature of Microsoft SQL Server 2008. In earlier versions of SQL Server it is not possible to pass table variable in store procedure as parameter. You can use Table-Valued Parameter to send multiple rows of data to a stored procedure or a function without creating a temporary table or passing so many parameters.

Thursday, January 17, 2013

Maintain div scroll position on postback

Sometimes we need to maintain the div scroll position on page postbacks. Here is how you can do it using JavaScript and Cookies.

Here I am simple using the cookie for store the current scroll position of div before postback and then set the div scroll position by reading the cookie which I nave stored in browser on page postback.

Wednesday, January 16, 2013

Get the list of all HttpModules in ASP.Net

Here I will give you a quick trick to get the list of all active HttpModules at runtime. We can get all the HttpModules from web.config or from machine.config file. But, If we want this at runtime then we can do this with the help of HttpApplication and HttpModuleCollection class. Below is the code snippet for getting the list of all active  HttpModules

Tuesday, January 15, 2013

Find the child element position inside the parent element using Jquery/Java Script

In this post I will explain how to find the child element position inside the parent element using jquery/java script.

Let's start, I have two div elements one is parent div and other is child div and a label to show the output.

Thursday, January 10, 2013

How to pass ASP.NET server side array to client side

In ASP.Net , this is a very often requirement to pass the server side array to client side and access them using java script. It this post I am describing the simplest way to pass the server side array to client side. Here I will show you two things, one is how to pass the server side array to client side and bind that array to empty "htmldropdown" list.
^ Scroll to Top