Wednesday, December 29, 2010

Create a javascript ToolTip within 10 minutes for page

Please visit my new Web Site

Sometimes we need to create handy javascript tooltip for client. Here in this article i will show how one can create a javascript tooltip within very short time by using DIV object. To do that here i use a DIV as a tooltip container. When i need to show the tooltip then i have set the DIV visibility style to 'visible' otherwise 'hidden'. Very simple right? Lets start:

Add an Aspx page in your project. Then add the below javascript method:
function DisplayToolTip()
            document.getElementById('divToolTip').style.left = window.event.x;
            document.getElementById('divToolTip') = window.event.y;

            document.getElementById('divToolTip').style.visibility = 'visible';
        function HideToolTip()
            document.getElementById('divToolTip').style.visibility = 'hidden';

Now add the below HTML markup code:
<span id="spanName" style="font-weight: bold;border: solid 2px red;" onmouseover="javascript:DisplayToolTip();"
    onmouseout="javascript:HideToolTip();">THIS IS THE SPAN</span>

    <div id="divToolTip" style="position: absolute; visibility: hidden; z-index: 20;
    background-color: white; border: solid 1px Blue;">This is ToolTip Text</div>

Now run the page hope you will get desired output:
Javascript Tooltip

Please note that this script does not run into mozilla firefox but will work in IE & Opera as well. To do that in easy way download built in jquery tooltip which is available in the internet. This is only a faster development technique for IE developers.

Friday, December 3, 2010

Using Server.Transfer how to pass values from source page to destination page

Please visit my new Web Site

It's not possible to pass value using query string from source page to destination page when using Server.Transfer. To pass data or value from source page to destination page while using Server.Transfer you can use HttpContext object. To do that add two aspx pages in your project & give name source.aspx & destination.aspx. In source.aspx page place a LinkButton. And under the LinkButton Click event write the below code:

To learn Difference Between Response.Redirect vs Server.Transfer Click Here.

protected void Linkbutton1_Click(object sender, EventArgs e)


HttpContext CurrContext = HttpContext.Current;

CurrContext.Items.Add("Name", "Shawpnendu Bikash Maloroy");

CurrContext.Items.Add("Address", "Dhaka, Bangladesh");



In Destination.aspx Page under Load event write the below code:
protected void Page_Load(object sender, EventArgs e)


if (!IsPostBack)


HttpContext CurrContext = HttpContext.Current;

Response.Write(CurrContext.Items["Name"].ToString()+" ");




Now run the source.aspx page & click on the LinkButton. You will get below output:


Hope now you can understand how to transfer or pass data between pages while using Server.Transfer.

Difference Between Server.Transfer vs Response.Redirect

Please visit my new Web Site

There is a common question for developers in interview board that "What is the difference between Response.Redirect and Server.Transfer". In a common term we can use both to redirect the user from source page to destination page. But there are some differences in between Response.Redirect and Server.Transfer, which i want to share with you.

1. A round trip occurs to the client before loading the destination page, which means after redirecting a page from source page to destination page a round trip occur into the client to update the address bar and history of the client browser. And also the destination page will be loaded by initiating a new request which is the 2nd request to the server.
2. To pass data in this mechanism you can easily use Query String or Session value.

1.It is a single request from source page to destination page. The destination.aspx will be loaded from the server without a second request. Means it will not update the address bar and history of the browser.
2. You will get better performance.
3. You cannot use Query String.
4. To pass data between souce.aspx page to destination.aspx by using HttpContext object. Click here to use HttpContext object.
5. You can also use session object to transfer data.
6. Users can not bookmark the destination.aspx page.
Want To Search More?
Google Search on Internet
Subscribe RSS Subscribe RSS
Article Categories
  • Gridview
  • Javascript
  • AJAX
  • Sql server
  • XML
  • CSS
  • Free Web Site Templates
  • Free Desktop Wallpapers
  • TopOfBlogs
    Free ASP.NET articles,C#.NET,VB.NET tutorials and Examples,Ajax,SQL Server,Javascript,Jquery,XML,GridView Articles and code examples -- by Shawpnendu Bikash