kuaileen_ 2015-09-24 06:47
浏览 2011

在repeater控件绑定时,如何根据条件改变字体的颜色

前台代码:

                <table border='0' align='center' cellpadding='5' cellspacing='2'  class='Data2'>
                    <tr class = 'Data_Header'>   <%if (Session["zdcx_jbleixing"].ToString() == "2")
                                                   {%>                     
                        <td nowrap="nowrap" style="display:none">icd10id </td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
            <tr class ='Data_Item'> <%if(Session["zdcx_jbleixing"].ToString()=="2") {%>

                         <td nowrap="nowrap" style="display:none">
                        <%# DataBinder.Eval(Container.DataItem, "icd10id")%>
                        </td>
                    </tr>
            </ItemTemplate>

            <AlternatingItemTemplate>
            <tr class ='Data_AlternatingItem' >
             <%if (Session["zdcx_jbleixing"].ToString() == "2")
               {%>
                        <td nowrap="nowrap" style="display:none">
                        <%# DataBinder.Eval(Container.DataItem, "icd10id")%>
                        </td>
                    </tr>
            </AlternatingItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>






                    后台代码:


                    protected void rep_JBZhenDuan_ItemDataBound(object sender,RepeaterItemEventArgs e )
{
     DataSet ds = GetCRB();//传染病数据
    DataRow Row = ((System.Data.DataRowView)(e.Item.DataItem)).Row as DataRow;
    Repeater rp = sender as Repeater;
    DataTable dt = rp.DataSource as DataTable; //repeater控件的数据源
    string icd10id = rp.FindControl("icd10id").ToString();//找到repeater控件里的icd10id
    if (dt.Rows.Count>0 &&ds.Tables[0].Rows.Count>0)
    {
        if (dt.Rows[e.Item.ItemIndex]["icd10id"] == ds.Tables[0].Rows[0]["icd10id"].ToString())//进行比较
        {


        }

    }    
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?