日期:2014-05-20  浏览次数:20419 次

在后台如何为表格添加已定义好的css样式
HTML code

<table id="tbAnswer" runat="server" style="margin:auto; margin-top:25px;" visible="false">
            <tr><td class="vipRole_td" colspan="2">测试页面</td></tr>
            <tr>
                <td><asp:TextBox ID="txtAnswer" runat="server" TextMode="MultiLine" Columns="50" Rows="10" MaxLength="500"></asp:TextBox></td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="测试内容不能为空!" ControlToValidate="txtAnswer"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td id="tdSubmint" runat="server" align="center"><asp:ImageButton ID="ibtnAnswer" runat="server" 
                        ImageUrl="~/Cp_Admin/images/SubmitAnswer.png" onclick="ibtnAnswer_Click" /></td>
            </tr>
        </table>


我想在网页的后台为id为tdSubmint单元格添加一个名称为"tdStyle"的样式,该如何解决?请高手帮下忙,谢谢……

------解决方案--------------------
tdSubmint.Attributes.Add("class","tdStyle");