开发者

dynamic padding to <td>

开发者 https://www.devze.com 2023-01-31 03:15 出处:网络
how to give padding to <td> from aspx.cs page i want to give set style=\"position: absolute; t开发者_StackOverflow社区op: 0; right: 0px; left: 173px; height: 32px; width: 50px;\"

how to give padding to <td> from aspx.cs page i want to give set

style="position: absolute; t开发者_StackOverflow社区op: 0; right: 0px; left: 173px; height: 32px; width: 50px;" 

this from aspx.cs page


If I understand you right you should:

  1. Add ID attribute to your <td> tag (for example ID="myControl")

  2. Add runat="server" attribute to your <td> tag.

    <td ID="myControl" runat="server"></td>

  3. Write following code in your aspx.cs file:

    myControl.Attributes.Add("style", "position: absolute; top: 0; right: 0px; left: 173px; height: 32px; width: 50px;");


<td> is a static HTML element, I think you have to use that style for DIV or SPAN

<table>
<tr>
    <td>
        <div id="div1" runat="server">
        </div>
    </td>
</tr> 
</table>

in aspx.cs

div1.Attributes.Add("style", "position: absolute; top: 0; right: 0px; left: 173px; height: 32px; width: 50px;");
0

精彩评论

暂无评论...
验证码 换一张
取 消