Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

My Tooltip is not wokring when any page event call in Gridview Control.

Following is the function of Tooltip mouseover and mouseout event.


C#
function SetTooltip() {
    var sPrefix = 'Tooltip.';
    //Getting all the elements from body which are Anchor tag
    var docElemnts = document.getElementsByTagName('a');
    alert(docElemnts);
    for (var e = 0; e < docElemnts.length; e++) {
        with (docElemnts[e]) {
            //Check founded Anchor tag is belongs to Tooltip
            if (getAttribute('rel') != undefined && getAttribute(&#39;rel&#39;) != null)
            {
                var rel = getAttribute('rel');

                //Check whether current element has rel attribute with "Tooltip."
                if (rel.indexOf(sPrefix) >= 0) {
                    var key = rel.split(sPrefix)[1];
                    for (tip in aTooltips) {
                        var str = aTooltips[tip];
                        //Perform a case-sensitive search
                        if (str.search(key) == 0) {
                            var Tooltip = str.split('¦')[1];
                            docElemnts[e].setAttribute('TooltipTitle', Tooltip.split('|')[0]);
                            docElemnts[e].setAttribute('TooltipDescription', Tooltip.split('|')[1]);
                            //Automatically attach mouse over and mouse out event to the Grid Action Button
                            alert(docElemnts[e].onmouseover);
                            docElemnts[e].onmouseover = AttachTooltip;
                            docElemnts[e].onmouseout = function () {
                                hideTooltip('DivTooltip');
                            }
                            break;
                        }
                    }
                }
            }
        }
    }
}
//Attaching event to the current element of the Grid Action Button
function AttachTooltip(e)
 {
     if (!e)
        var e = window.event;
        showTooltip(e, 'DivTooltip', this.getAttribute('TooltipTitle'), this.getAttribute('TooltipDescription'));
}
Posted
Comments
Sergey Alexandrovich Kryukov 27-Apr-11 11:58am    
Tag it! Forms, WPF, ASP.NET, what?
Please don't tell me it is apparent in your code. Why will volunteer to look at your code if you did not even properly classify your topic?
--SA

1 solution

Hello nial,

You need to examine HTML generated for your page with or without page event/grid. see if any tag is broken.

if you can provide more code having your gridview control it will help us to get the exact problem.


Thanks,
Hemant
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900