开发者

How do I fix the button's position?

<table>
    <tr>
        <td>
            <div style="margin-left: 220px;">
                <asp:Button ID="btn1" Text="Edit" CommandArgument='<%#Eval("UserID") %>'
                    Ca开发者_JAVA百科usesValidation="false" CommandName="Edit" Visible="false" runat="server" />
        </td>
        </div>
        <td>
            <div style="margin-left: 370px;">
                <asp:Button ID="btn2" Visible="false" Text="Edit" CommandArgument='<%#Eval("UserID") %>'
                    CausesValidation="false" CommandName="Edit" runat="server" />
            </div>
        </td>
    </tr>
</table>

The problem is when both buttons are made visible dynamically..the second button shifts right wards..how do I fix their position so they appear exactly where I want them ?

[edit] Do I need to use span or something instead of those divs ? IS there an HTML property that lets u fix a position of an element on page ? How do u do it ? I hv been googling but nothing came up..plz help

[edit 2] I just added position:fixed in style attribute in the two buttons..when I ran the code again..both buttons didn't even appear! how do u do it if not even this way ?

[edit 3]

I removed the divs and set both "td's" align property to centre..now the edit buttons are both appearing on the left together :/


Set a fixed width on the columns. Also you need to fix the ordering of your td and div tags

<table>
  <tr>
    <td width="200px">
      <asp:Button ID="btn1" Text="Edit" CommandArgument='<%#Eval("UserID") %>' CausesValidation="false" CommandName="Edit" Visible="false" runat="server" />
    </td>
    <td width="200px">
      <asp:Button ID="btn2" Visible="false" Text="Edit"    CommandArgument='<%#Eval("UserID") %>' CausesValidation="false" CommandName="Edit" runat="server" />
    </td>
  </tr>
</table>

Will make the column 200px wide, just replace it with whatever width that suits your needs.

Edit: And well you don't really need the div tags for what you are doing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜