在gridiview标题上显示导出选项 [英] Show export option on gridiview header

查看:55
本文介绍了在gridiview标题上显示导出选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,





我有gridview,它与数据表绑定。

现在我想要导出该数据。因为我想在标题上显示选项。而mouseover显示div标签..



可以根据鼠标悬停和鼠标移动来显示和隐藏gridview标题上的div ..





感谢你们所有.. !!

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..!!

推荐答案

为此,你需要拥有JavaScript onmousein &控件的 onmouseout 。在JS方法中,根据需要显示/隐藏放置在某处的div。此div将包含您要显示的文本。



您可以通过以下方式执行以下操作:

1.在鼠标悬停和放大器上注入Javascript功能;鼠标悬停在网格行中的链接。

2.使用JavaScript,当您将鼠标悬停在该行上时,显示包含所需详细信息的div(此处为图像)

3使用JavaScript,隐藏div onmouseout。





对于注入JS,你需要使用 RowDataBound 的GridView,类似于:

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:
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);");
   }
}



显示网格单元格的div onmouseover 事件,

隐藏网格单元格的div onmoustout 事件。



放置相同的逻辑对于你想拥有它的任何/所有控件。



试试!


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!


这篇关于在gridiview标题上显示导出选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆