日期:2014-05-18  浏览次数:20428 次

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, &nbs