现在我有个repater绑定,然后里面有个工号字段的,我想让指定的工号所对应的这一行变色,怎么处理?
解决方案 »
- 三层中业务逻辑层也定义个接口层好不好?
- tabao File System 这个文件系统,有用过的朋友吗
- asp.net访问时提示要输入用户密码,是什么问题
- 来者有分(在线,特急),给我的网站起个名字,个人网络俱乐部,以IT为主题的!
- 万分火急,不知道是不是masterPage的BUG!
- 执行插入数据时,如果数据类型是int型并且为空值时发生错误,如何解决??
- 寻.NET文档
- 如何批量下载数据库中的记录
- asp.net 中读取datatable中的字段值出错
- 求助:谁知道比较好的在线图像编辑控件
- 如何给top.location.href带参数?
- 一个读取Excel文件的问题,麻烦高手、大神、牛逼人物帮忙指点一下,万分感谢!!!
行的话tr加ruant=server,列的话td加runat=server
后台循环repeater,取到前台的控件,直接加background-color样式
http://www.cnblogs.com/insus/archive/2013/05/19/3086475.html
http://www.cnblogs.com/insus/archive/2013/05/06/3063688.html
http://www.cnblogs.com/insus/archive/2013/05/05/3060540.html
楼主你对只要对某个id的前面动态加上样式就可以了。比如repater内的行
<tr class='id_<%# Eval(id) %>'> </tr>之后不管你是用JS Jquery 还是直接在css 改变样式就可以了
假设你特定的id是 1
只要在样式中 .id_1{background:#ddd} 来设置背景色就可以了。
可以同样的方法给 td加,或者
<tr><span class='id_<%# Eval(id) %>'></span></tr>
或者用div布局更方便些。
onmouseout="if(this.style.backgroundColor!='#b9cddd')this.style.backgroundColor='#ECF5FF'"
onclick="var trs = this.parentNode.getElementsByTagName('tr');for( i=0;i<trs.length;i++ )trs[i].style.backgroundColor='#ECF5FF';this.style.backgroundColor='#b9cddd'">就可以了如下,给个例子你,
<table cellspacing="0" style="width:96%; text-align:center" class="table">
<asp:Repeater ID="Repeater1" runat="server" >
<HeaderTemplate>
<tr>
<th>
NO.
</th>
<th>
被调查人姓名
</th>
<th>
工号
</th>
<th>
部门
</th>
<th>
职位
</th>
<th>
填写调查表
</th>
<th>
查看调查表
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr onmouseover="if(this.style.backgroundColor!='#b9cddd')this.style.backgroundColor='#CEE3F8'"
onmouseout="if(this.style.backgroundColor!='#b9cddd')this.style.backgroundColor='#ECF5FF'"
onclick="var trs = this.parentNode.getElementsByTagName('tr');for( i=0;i<trs.length;i++ )trs[i].style.backgroundColor='#ECF5FF';this.style.backgroundColor='#b9cddd'">
<td>
<asp:Label ID="NO" runat="server" Text='<%# Container.ItemIndex + 1%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblRespondents_Name" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"USER_DspName") %>'></asp:Label>
</td>
<td>
<asp:Label ID="lblRespondents_No" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Respondents_No")%>'></asp:Label>
</td>
<td>
<asp:Label ID="lblRespondents_Depart" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"USER_CostCenter") %>'></asp:Label>
</td>
<td>
<asp:Label ID="lblRespondents_Level" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"USER_Level") %>'></asp:Label>
</td>
<td>
<a href="Fill_Survey.aspx?ID=<%# DataBinder.Eval(Container.DataItem,"ID") %>">
<img src="../Images/edit.png" alt="Fill the FeedBack" border="0" />
</a>
</td>
<td>
<a href="My_FillSurvey_List.aspx?ID=<%# DataBinder.Eval(Container.DataItem,"ID") %>">
<img src="../Images/view.gif" alt="View the FeedBack" border="0" />
</a>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>