首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

GridView上悬停鼠标的事件~下面的代码如何结合起来用~help me

2012-01-10 
GridView上悬停鼠标的事件~下面的代码怎么结合起来用~help me 前台代码ItemTemplateahref .\News\news

GridView上悬停鼠标的事件~下面的代码怎么结合起来用~help me

前台代码
<ItemTemplate>
                                                                        <a   href= '.\News\news_more.aspx?NewsID= <%#   DataBinder.Eval(Container, "DataItem.NewsID ")   %> '>
                                                                                <%#   SubStr(Convert.ToString(DataBinder.Eval(Container,   "DataItem.NewsTitle ")),   16)%>
                                                                        </a>
                                                                       
                                                                </ItemTemplate>
后台代码
protected   void   GridView1_RowDataBound(object   sender,   GridViewRowEventArgs   e)
        {
                if   (e.Row.RowType   ==   DataControlRowType.DataRow)//不遍历行头和行尾
                {
                        e.Row.Attributes.Add( "onmouseover ",   "this.style.backgroundColor= 'LightSkyBlue ' ");//鼠标移入显示的颜色
                        e.Row.Attributes.Add( "onmouseout ",   "this.style.backgroundColor= '#ced7f7 ' ");//鼠标移出显示的颜色                      

                        //这里就是你要的效果
                        e.Row.Cells[0].ToolTip   =   e.Row.Cells[0].Text;
                     
                }
        }
    public   string   SubStr(string   sString,   int   nLeng)
        {
                if   (sString.Length   <=   nLeng)
                {
                        return   sString;
                }
                string   sNewStr   =   sString.Substring(0,   nLeng);
                sNewStr   =   sNewStr   +   "... ";


                return   sNewStr;
        }
怎么样能结合起来实现鼠标悬停的时候显示完整的绑定信息呢?

[解决办法]
title= 'admin '> admin 2007-7-15
title= 'Eyifan专栏 '> Eyifan专栏 2007-12-30
title= 'Bindows '> Bindows 2007-12-30
title= ' 多层式解决方案保护静态数据 '> 多层式解决方案保护静态数据 2007-12-30
title= '少年黑网站为炫耀 黑客心理拷问社会文化 '> 少年黑网站为炫耀 黑客心理拷问社... 2007-12-30
title= 'McAfee: 2007年度十大安全威胁名单 '> McAfee: 2007年度十大... 2007-12-30
------------------
应该是这样的吧
<a href= ".. " title= 'admin '> admin 2007-7-15 </a>

title肯定要在某个元素里面的

热点排行