如何在gridview的行鼠标悬停事件上显示另一个网格视图 [英] how to display another grid view on row mouse hover event of gridview
本文介绍了如何在gridview的行鼠标悬停事件上显示另一个网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对此有一个建议,因此请事先提供建议...
i have a prblm regarding these so plz give suggestions thanx in advance.....
推荐答案
请参阅以下链接以供参考
使用CSS的GridView行的悬停效果 [ ^ ]
http://aspdotnetfaq.com/常见问题解答/如何正确突出显示GridView-鼠标悬停在ASP-NET.aspx中 [ http://forums.asp.net/t/1176461.aspx [
see this links below for your reference
Hover Effects for GridView Rows Using CSS[^]
http://aspdotnetfaq.com/Faq/How-to-correctly-highlight-GridView-rows-on-Mouse-Hover-in-ASP-NET.aspx[^]
http://forums.asp.net/t/1176461.aspx[^]
Vote and Accept solution
If this will help you
thanks
代替使用默认的WebControls.GridView,我们可以创建一个自定义的HouseGridView,如下所示:
In stead of using default WebControls.GridView, we can create a custom HouseGridView as:
[ToolboxData("<{0}:HoverGridView runat=server></{0}:HoverGridView>")]
public class HoverGridView : System.Web.UI.WebControls.GridView
{
public bool MouseHoverRowHighlightEnabled
{
get
{
if (ViewState["MouseHoverRowHighlightEnabled"] != null)
return (bool)ViewState["MouseHoverRowHighlightEnabled"];
else
return false;
}
set { ViewState["MouseHoverRowHighlightEnabled"] = value; }
}
public Color RowHighlightColor
{
get
{
if (ViewState["RowHighlightColor"] != null)
return (Color)ViewState["RowHighlightColor"];
else
{
return Color.Yellow;
}
}
set { ViewState["RowHighlightColor"] = value; }
}
protected override void OnRowCreated(GridViewRowEventArgs e)
{
base.OnRowCreated(e);
if (MouseHoverRowHighlightEnabled)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover",
string.Format("this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='{0}'",
ColorTranslator.ToHtml(RowHighlightColor)));
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;");
}
}
}
}
这篇关于如何在gridview的行鼠标悬停事件上显示另一个网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文