zoukankan      html  css  js  c++  java
  • repeter选中行修改颜色

    前台界面关键代码:

    <ItemTemplate> <tr runat="server" id="tabtr1"><td style=" text-align:center;"><%# Container.ItemIndex + 1 + (pagerBasic.CurrentPageIndex - 1) * 10%></td>
    在界面给tr加上id便于后台获取。
    <td style=" text-align:center;">
    <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("mid")%>' />
    <asp:CheckBox ID="cbxChild" runat="server" AutoPostBack="True" 
    oncheckedchanged="chk_CheckedChanged" />
    </td>
    </tr></ItemTemplate>
    用CheckBox进行选中变色。
    后台关键代码:
    protected void chk_CheckedChanged(object sender, EventArgs e)
    {
    for (int i = 0; i < Repeater1.Items.Count; i++)
    {
    Boolean isChecked = ((CheckBox)Repeater1.Items[i].FindControl("cbxChild")).Checked;
    if (isChecked)
    {
    HtmlTableRow col = (HtmlTableRow)Repeater1.Items[i].FindControl("tabtr1");
    col.BgColor = "#5F9EA0";
    }
    else
    {
    //#c7c7c7
    HtmlTableRow col = (HtmlTableRow)Repeater1.Items[i].FindControl("tabtr1");
    col.BgColor = "#ffffff";
    }

    }
    }

  • 相关阅读:
    线段树区间最大子段和
    NTT数论变换
    cdq分治·三维偏序问题
    线段树区间开方
    怎么联系$zcy$呢?
    题解 CF375D 【Tree and Queries】
    点分治模板
    Good Bye 2018题解
    Hello 2019题解
    Codeforces Round #525 (Div. 2)题解
  • 原文地址:https://www.cnblogs.com/njccqx/p/6433000.html
Copyright © 2011-2022 走看看