Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
In my application there are no.of TextBoxes. i can set the ToolTip for those. how to set it for OutSide the Gridview not a Inside Gridview.
Posted
Updated 17-Jul-12 22:48pm
v3
Comments
MAU787 18-Jul-12 4:38am    
what is tooltrip??
r u asking about tooltip?
pradiprenushe 18-Jul-12 5:51am    
Are you talking about normal textbox?

try one of the jQuery tooltip plugins. http://craigsworks.com/projects/qtip/[^]
 
Share this answer
 
Comments
CH Guravaiah 18-Jul-12 4:40am    
In my project using only JavaScript . and also doesn't work that URL
You can use this code for the give a tooltip to a particular column

C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              Utility.RowColorChange(e);
              for (int colIndex = 0; colIndex < e.Row.Cells.Count; colIndex++)
              {
                  string ToolTipString = "Edit Records";
                  e.Row.Cells[5].Attributes.Add("title", ToolTipString);
              }
          }
      }


and also follow the link................

http://www.dotnetobject.com/Thread-ToolTip-for-GridView-Cell-asp-net[^]
 
Share this answer
 
<asp:textbox id="TextBox1" tooltip="Enter Tool Tip Text" runat="server" xmlns:asp="#unknown">
 
Share this answer
 
how to set it for OutSide the Gridview not a Inside Gridview.
Tooltip is to show a content on hover of a control, near by the control itself.

If your requirement is to show it but far away from control then lets say it will be suggestion/hints/help content related to it which would appear on hover of it.
For this, you need to have javascript onmousein & onmouseout for the control. In the JS method, show/hide a div placed somewhere as per your need. This div will have text that you want to show.

You can do the following by:
1. Inject Javascript function on mousehover & mouseout of the link in a grid row.
2. Using JavaScript, show a div that contains the needed details(image here) when you hover your mouseover that row
3. Using JavaScript, hide the div onmouseout.


For injecting JS, you need to use RowDataBound of GridView, something like:
C#
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{ 
   DataControlRowType rtype = e.Row.RowType;  
   if (rtype == DataControlRowType.DataRow && rtype != DataControlRowType.Footer
       && rtype != DataControlRowType.Separator && rtype != DataControlRowType.Header
       && rtype != DataControlRowType.Pager)  
   { 
      // Control specific
      TextBox tb = (TextBox)e.Row.FindControl("myTextBox");
      
      // Show div         
      tb.Attributes.Add("onmouseover", "ShowDiv(this);");
      //Hide div
      tb.Attributes.Add("onmouseover", "HideDiv(this);");
   }
}

Show the div onmouseover event of the grid cell, and
Hide the div onmoustout event of the grid cell.

Put the same logic for any/all controls that you want to have it.

Try!
 
Share this answer
 
Comments
CH Guravaiah 18-Jul-12 5:15am    
Need logic of the Outside the Gridview
Sandeep Mewara 18-Jul-12 5:53am    
Thats a logic for placing it ANYWHERE.(that includes outside grid too!)

Since the control is inside grid as per question, sample suggests accordingly. Try!
If the textbox is outside the gridview, then select that particular textbox and look for its properties, you will have a tooltip in properties window of that particular textbox. Enter your text there.
 
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