如何在ASP.NET中更改中继器的行值 [英] How to change a row value of repeater in asp.net

查看:70
本文介绍了如何在ASP.NET中更改中继器的行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我有一个中继器,如:

Hi All,


I have a repeater as :

<asp:Repeater ID="Repeater1" onitemdatabound="Repeater1_ItemDataBound" runat="server">
        <HeaderTemplate>
        <table id="tab1" width="80%" cellpadding="-1" cellspacing="-1" border="1">
        <tr>

        <td colspan="8" class="style10" align="center">Attendance Sheet : APV India Pvt. Ltd. </td>
        </tr>
        <tr>
         <td colspan="8" class="style10"  align="left">Date:<asp:Label ID="lblDate" runat="server" Text=""></asp:Label> </td>
        </tr>
       <tr>
       <td class="style12" align="center" style="width:10%">S.No.</td>
       <td class="style12" align="center" colspan="3">Employee Name</td>
       <td class="style12" align="center" style="width:10%">Time In</td>
       <td class="style12" align="center" style="width:10%">Time Out</td>
       <td class="style12" align="center" colspan="2">Status</td>
       </tr>
        </HeaderTemplate>
        <ItemTemplate>
        <tr>
       <td class="style13" align="center" style="width:10%"><%#Container.ItemIndex + 1%></td>
       <td class="style13" align="left" colspan="3"><%#DataBinder.Eval(Container.DataItem, "Employee")%></td>
       <td class="style13" align="center" style="width:10%"><%#DataBinder.Eval(Container.DataItem, "OfficeIn")%></td>
       <td class="style13" align="center" style="width:10%"><%#DataBinder.Eval(Container.DataItem, "OfficeOut")%></td>
       <td class="style13" align="center" colspan="2"><%#DataBinder.Eval(Container.DataItem, "Status")%></td>
       </tr>
        </ItemTemplate>
        <FooterTemplate>
          <tr>
        <td class="style12" align="center" colspan="8">APV Attendance Sheet</td>
        </tr>
         </table>
        </FooterTemplate>

        </asp:Repeater>





现在我想根据状态值从代码后面更改Repeater1_ItemDataBound上行的颜色.


谢谢
mohd wasif





Now I want to change color of a Row on Repeater1_ItemDataBoundfrom code behind on basis of Status value.


thanks
mohd wasif

推荐答案

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {

             if (((Evaluation)e.Item.DataItem).Rating == "Good") {
                e.Item.BackgroundColor = "######";
             }
          }


这篇关于如何在ASP.NET中更改中继器的行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆