datalist 后台怎么获取div 并赋样式
<asp:DataList ID="dlshebeijibenxinxiTableImageList" runat="server" RepeatColumns="4"OnItemDataBound="dlshebeijibenxinxiTableImageList_ItemDataBound">
<ItemTemplate>
<table class="MS_TBL" border="1px" cellpadding="1px" cellspacing="1px" width="210px">
<tr>
<td colspan="2">
设备编号:<%# Eval("shebeidaihao")%>
</td>
</tr>
<tr>
<td colspan="2">
<div id="iamgeDiv" runat="server" style=" float:left;">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../Image/shebie.jpg'
Width="150px" Height="62px" CommandArgument='<%#Eval("shebeiID")%>' CommandName="Edit" />
</div>
<asp:Label ID="lblzhuangtai" runat="server" Text='<%#Eval("zhuangtai")%>'></asp:Label>
</td>
</tr>
<tr>
<td style="background-color: Blue;">
<asp:ImageButton ID="imgBtnchangdu" runat="server" ImageUrl="../Image/1.jpg" Height="20px" />
</td>
<td style="text-align: right">
<asp:Label ID="Label1" CssClass="ziti" runat="server" Text="45%"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
后台代码
HtmlGenericControl imangDiv = e.Item.FindControl("iamgeDiv") as HtmlGenericControl;
imangDiv .Style.Add("background-color", "red");
--------------------编程问答-------------------- 给DIV加个 runat="server" 然后FINDCONTROL试试 --------------------编程问答-------------------- 你想表达什么意思?你这么写没有问题的,可以看看生成的html,样式可能已经加上了,但是被前面的asp:ImageButton 什么的给遮住了
补充:.NET技术 , ASP.NET