我用代码选中一个数据源控件中的一个CheckBox,如何用jquery让这行灰掉?
选中一行灰一行,我需要在系统里实时判断。求解

解决方案 »

  1.   

    http://www.51obj.cn/demo/jquery/jquery_table.html
      

  2.   

    $(":checkbox").chick(function() {
       if($(this).attr("checked")) {
          $(this).parents("tr").eq(0).css("background-color","blue");
       } else {
          
       }
    });
      

  3.   

    $(":checkbox").each(function()  {
     if($(this).attr("checked")) {
          $(this).parents("tr").eq(0).css("background-color","gray");
       }
    });
      

  4.   

    这个选择器你需要修改的,毕竟我不知道你的HTML。不过意思就是 这个
      

  5.   

    邓肯兄,你好。我是在Button2_Click事件中判断的,通过代码改变数据库中的bool字段为"true",然后在页面判断这行中的CheckBox选中。  this.lstOrders.DataBind();   
                for (int i = 0; i < lstOrders.Items.Count; i++)
                {
                    if (reader.Read())
                    {
                        if (reader["bool"].ToString() == "true")
                        {
                            ((CheckBox)lstOrders.Items[i].FindControl("cb")).Checked = true;
                        }
                    }            }<td style="height: 20px; background-color: #FFFFFF">
                                <div style="text-align: center">
                                    <span>
                                        <asp:CheckBox ID="cb" runat="server" Enabled="false"/></span>
                                </div>
                            </td>
      

  6.   

    如何在后台加?我这里不能用listview自带的事件呢··
      

  7.   

    http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx
      

  8.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>测试</title>
    <style>
    .high{
    background:#999;
    }
    </style>
    <script src="jquery-1.3.2.js"></script>
    <script>
    $(function(){
    $("input[type=checkbox]").change(function(){
    if($(this).is(":checked")){
    $(this).parent().css("readonly",true);
    $(this).parent().addClass("high").siblings().removeClass("high");
    }else{
    $(this).removeClass("high");
    }
    });
    });
    </script>
    </head><body>
    <div class="test"><input type="checkbox" />11111</div>
    <div class="test"><input type="checkbox" />22222</div>
    <div class="test"><input type="checkbox" />33333</div>
    <div class="test"><input type="checkbox" />44444</div>
    </body>
    </html>
    是这样吗
      

  9.   


    GridView1.Rows[i].Cells[4].BackColor = System.Drawing.Color.Red;GridView里面能这么写。ListView只能点到lstOrders.Items[i]后面就没控件的样式了。郁闷
      

  10.   

    回lieri111兄。
    页面打开没效果,ChcekBox被程序判断选中也没效果
      

  11.   


    $("input[type=checkbox]").change(function()能否改成,页面一加载就判断checkbox是否被选中了,现在checkbox被选中不是手动点击,是程序判断,然后给自动勾选中的