Gridview Tooltip

 

 

 

前台:

 


                       
                           
                       
                       
                           
                           
                       
                   

                                                              BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3"
                                GridLines="None"  Width="100%" CellSpacing="1"
                                    onrowdatabound="GridView1_RowDataBound" AllowPaging="True"
                                    onrowcreated="GridView1_RowCreated" onrowcommand="GridView1_RowCommand">
                               
                               
                               
                              
                               
                               
                                                                    HorizontalAlign="Center" />
                               
                               
                           

                           

                            

 

 

 

后台:

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //鼠标移动到每项时颜色交替效果
            //e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
            //e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");

            //e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#A9A9A9';");


            //e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");

            e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#C0C0FF';this.style.cursor='hand';showDetail('" + e.Row.Cells[0].Text + "','" + e.Row.Cells[1].Text + "')");
       

            e.Row.Attributes.Add("onmouseout", "hide();this.style.backgroundColor=currentcolor;");

 

            //单击/双击 事件
            e.Row.Attributes.Add("OnDblClick", "DbClickEvent('" + e.Row.Cells[1].Text + "')");
            //   e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.Cells[1].Text + "')");

            e.Row.Attributes.Add("OnKeyDown", "GridViewItemKeyDownEvent('" + e.Row.Cells[1].Text + "')");

            //设置悬浮鼠标指针形状为"小手"
            e.Row.Attributes["style"] = "Cursor:hand";

        }
    }

你可能感兴趣的:(小技术备份)