repeter选中行变色

protected void chk_CheckedChanged(object sender, EventArgs e)
    {
        for (int i = 0; i < rptBasic.Items.Count; i++)
        {
            Boolean isChecked = ((CheckBox)rptBasic.Items[i].FindControl("cbxChild")).Checked;
            if (isChecked)
            {
                HtmlTableRow col = (HtmlTableRow)rptBasic.Items[i].FindControl("tabtr1");
                col.BgColor = "#5F9EA0";
            }
            else
            {
                //#c7c7c7
                HtmlTableRow col = (HtmlTableRow)rptBasic.Items[i].FindControl("tabtr1");
                col.BgColor = "#ffffff";
            }

        }
    }

 

posted @ 2018-09-19 08:30  it写代码  阅读(143)  评论(0编辑  收藏  举报