C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Dynamic Tool Tip in webapplications


Posted Date: 03 Aug 2006    Resource Type: Articles    Category: .NET Framework
Author: Roopesh RajendranMember Level: Gold    
Rating: Points: 10



It can be used for any server or client control depends on our use. One draw back I found on this tooltip won't work if your visitor has JavaScript turned off. In this section, I will explain it with simple example.
If you want to show a tool tip when the mouse on the particular column cells. For example we need to show the “description” of “Cust_Id “in the tooltip.
For the above example first we need to bind the customer Id and the description in two different columns and make description bind column visibility property to false. On item data bound we need to bind that description field value into a hidden variable. Let us assume customer description column number in data grid equals 9 cust Id column number equals 4 and hidden variable Id equals hdnDisc then













if(e.Item.ItemType==ListItemType.AlternatingItem ||e.Item.ItemType==ListItemType.Item
|| e.Item.ItemType==ListItemType.SelectedItem)
{
hdnDisc.Value = e.Item.Cells[8].Text;// binding value to hidden variable
}

Also we need to bind two java script functions to show and hide the tool tip. For that, include this code also in item data bound.

e.Item.Cells[3].Attributes.Add("onmouseover","TooltipShow(this,'" + hdnDisc.ClientID + "')");
e.Item.Cells[3].Attributes.Add("onmouseout","TooltipHide()”);
Then we need to write the code for java script functions
function TooltipShow(obj,hdn)
{
if (document._tiptmr) window.clearTimeout(document._tiptmr); hdnobj=document.getElementById(hdn);
document.getElementById("ToolTip").innerHTML= document.getElementById(hdn).value;
document.getElementById("ToolTip").style.pixelLeft= event.clientX;
// -10 is used to show tip below the current row
document.getElementById("ToolTip").style.pixelTop=event.clientY-10;
document.getElementById("ToolTip").style.visibility='visible';
//used after this time it’s automatically removes if you want
document._tiptmr=window.setTimeout("TooltipHide ()",6000);
}
function TooltipHide()
{
document.getElementById("ToolTip").style.visibility='hidden';
}
And we need to provide a div for showing tool tip by using the code on aspx page.


And we can also provide extra style on this div to make our Tool Tip excellent and make your GUI more users friendly!!!!!!!!!!!!!!!




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Abstract Class Concept
Previous Resource: NameSpaces
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use