【问题标题】:Simple Gridview and button problems. I am learning Asp.Net. Please help me out!简单的 Gridview 和按钮问题。我正在学习 Asp.Net。请帮帮我!
【发布时间】:2010-08-10 22:01:12
【问题描述】:

我不会说我浪费了我的时间,但我花了大约几个小时来改变它。却徒劳无功。有人可以帮帮我吗。 在以下代码中:

  1. 我需要在禁用位置(标题)和网格视图之间使用中断
  2. 我希望网格的边框颜色为无。我不想要任何颜色。
  3. 我希望按钮禁用或停用和取消都显示在网格视图下方。并在页面中间。

请帮帮我!!非常感谢。

<body>
    <form id="form1" runat="server">

    <div style="display: block; background: url(images/reusable_blue_bg.jpg) repeat-x 0 -15px;
        border-left: #88b9c7 1px solid; border-bottom: #88b9c7 1px solid; border-top: #88b9c7 1px solid;
        border-right: #88b9c7 1px solid; padding: 0px 2px; height: 236px; min-height: 236px;
        height: auto; margin-left: auto; margin-right: auto;">
        <table align="center" style="width: 554px; border-top-style: none; border-right-style: none;
            border-left-style: none; border-bottom-style: none" id="TABLE1">

            <tr>
                <td align="center" colspan="5" style="font-weight: normal; font-size: 20px; margin: 0px;
                    font-family: Arial; color: #1e7c9b;">
                    Disable Location</td>
            </tr>

我这里需要一号..

            <asp:GridView ID="disableloc" runat="server" AutoGenerateColumns="False" DataKeyNames="LocationName"
                DataSourceID="" AllowPaging="True" EnableViewState="true" BorderStyle="None">

我想这里要两个,我猜

            </asp:GridView>

我要3个在这里..

            <tr align ="center" style="position:fixed">
               <asp:ImageButton ID="btnDisable" runat="server" ImageAlign="Middle" ImageUrl="~/images/green-deactivate.gif" OnClick="btnDisable_Click"
                    ValidationGroup="group1" />

               <asp:ImageButton ID="btnCancel" runat="server" ImageUrl="~/images/cancel.gif" OnClick="btnCancel_Click" />

            </tr>
         </table>

    </div>

非常感谢!!

【问题讨论】:

  • 你能发布什么不起作用吗? (少码多字!)
  • 我确实编辑了代码以使其变得简单。谢谢尼克斯!!

标签: c# asp.net html


【解决方案1】:
  1. 在标题 td 的样式上使用 padding-bottom 来获取标题和 gridview 之间的空间。
  2. 在 GridView 上使用 gridlines="None"。
  3. 将 GridView 和按钮都包装在 tds 中,现在它们直接在 tr 中,这不完全是 html,因此按钮在表格的左上角结束。

【讨论】:

    猜你喜欢
    • 2014-03-08
    • 1970-01-01
    • 2023-04-02
    • 2021-07-04
    • 2016-03-19
    • 2021-03-30
    • 2022-11-30
    • 1970-01-01
    • 2018-03-24
    相关资源
    最近更新 更多