Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,


I have gridview which is bind with datatable.
now i want to export that data on . for that i want show option on header. while mouseover show that div tag..

Can any idea for showing and hide a div on gridview header based on mouseover and mouseout..


Thank To You All..!!
Posted

1 solution

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.Header)  
   { 
      // Control specific - Label or Textbox
      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
fjdiewornncalwe 28-Mar-13 15:21pm    
+5.
Sandeep Mewara 28-Mar-13 23:54pm    
Thanks Marcus.
Maciej Los 28-Mar-13 17:14pm    
A5!
Sandeep Mewara 28-Mar-13 23:54pm    
Thanks Mac.
sariqkhan 29-Mar-13 1:13am    
sandeep sir can you help me out here
http://www.codeproject.com/Questions/569299/loadingplusmoreplusthanplusoneplusreportsplusinplu

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