Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a custom tooltip for my radgrid because I have a requirement to display 5000 character in tooltip, I have done with all my requirement, but got stuck when I mouseover the last row of the grid it displays tooltip below the viewport, unable to view complete tooltip. please refer below my code, please someone help to adjust those tooltip to display within viewport only:

What I have tried:

C#
<radG:GridTemplateColumn DataField="Remarks" HeaderText="Update / Remark" UniqueName="UpdateRemarks">
                            <ItemTemplate>
                                <asp:Label ID="lblRemarks" runat="server" CssClass="tooltip" Text='<%#Eval("Remarks")%>'
                                    ToolTip='<%#Eval("FullRemarks")%>' onmouseover="showTooltip(this)"
                                    onmouseout="hideTooltip(this)"></asp:Label>

                            </ItemTemplate>
                            <HeaderStyle Width="200px" />
                            <ItemStyle CssClass="wraptext" />
                        </radG:GridTemplateColumn>


for javascript functions :
JavaScript
function showTooltip(control) {
    var ttext = control.title;
    var tt = document.createElement('SPAN');
    var tnode = document.createTextNode(ttext);
    tt.appendChild(tnode);
    control.parentNode.insertBefore(tt, control.nextSibling);
    tt.className = "tooltipCss";
    control.title = "";
}
function hideTooltip(control) {
    var ttext = control.nextSibling.childNodes[0].nodeValue;
    control.parentNode.removeChild(control.nextSibling);
    control.title = ttext;
}

and for CSS:
CSS
 .tooltipCss
{
    position: absolute;
    border: 1px solid gray;
    margin1: 1em;
    padding: 1px;
    background: white;
    font-family: Arial;
    font-weight: normal;
    color: blue;
    font-size: 9px;
    /*width: 400px;
    max-height: 250px;
    overflow-y: scroll;*/
    text-wrap: normal;
    border-radius: 2px 2px 2px 2px;
}
Posted
Updated 5-Sep-16 3:24am
v2
Comments
Shaikh Nadeeem 5-Sep-16 9:17am    
Either help me for that tooltip content display within viewport or allow that content to make scrollable.
David_Wimbley 5-Sep-16 10:06am    
I think your larger issue here is that you are trying to show a novel in a tool tip. This seems more like a bad UI/UX decision than anything.

Tooltips aren't meant to be used to display the latest new york times, they are meant for quick/meaningful explanations of whatever it is the data you are displaying that may need brief/concise explanation. 5,000 characters in a tool tip is crazy.

It would seem you are better off creating your own plugin or doing a master/detail type grid where when they press the plus sign, a new row appears below the master row displaying your 5,000 characters of text.
Shaikh Nadeeem 5-Sep-16 10:21am    
David_Wimbely thanks for your response I know tooltips are short intro of the content but its my client's requirement, So I'l have to do that, request you to give some suggestions for either display withing viewport or make tooltip scrollable. Thanks in Advance
Karthik_Mahalingam 5-Sep-16 13:49pm    
try with z index css
Shaikh Nadeeem 6-Sep-16 2:54am    
with z index also it is not working

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