如何在鼠标悬停时在gridview的第一列显示复选框

时间:2012-04-14 07:00:56

标签: c# jquery asp.net gridview

我认为如果我们选择chrome browser我们将获得所有浏览数据,每个人都知道History。当我们将鼠标悬停在特定行上时,check box可见,当我们选择该按钮时,如何执行此类场景

enter image description here

3 个答案:

答案 0 :(得分:1)

将复选框设置为display:none,然后尝试此

protected void RecordsGrid_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {

                    e.Row.Attributes.Add("onmouseover","checkbox.style.display='block'");
                    e.Row.Attributes.Add("onmouseout", "checkbox.style.display='none'");
                }
            }

答案 1 :(得分:0)

@User:您好,您可以使用j查询显示复选框,以便按照以下链接突出显示行,但使用相同的基础,您可以使复选框可见,按钮也可以。

http://www.dotnetcurry.com/ShowArticle.aspx?ID=250

http://jquerybyexample.blogspot.com/2011/06/highlight-row-on-mouseover-in-gridview.html

答案 2 :(得分:0)

试试这个

   $(function(){
            $("#gridviewname tr").live("hover",function(){
                 $(this).find("input[id*='chkName']").show();
            },
            function(){
                 $(this).find("input[id*='chkName']").hide();
            });

            $("#gridviewname tr").live("click",function(){
                 if($(this).find("input[id*='chkName']").attr("checked"))
                 {
                       $(this).find("input[id*='chkName']").removeAttr("checked");
                       $(this).find("input[id*='chkName']").hide();
                 }
                 else
                 {
                       $(this).find("input[id*='chkName']").attr("checked",true);
                       $(this).find("input[id*='chkName']").show();
                 }
            });

         });