简单的Gridview和按钮问题。我正在学习Asp.Net。请帮帮我!

时间:2010-08-10 13:59:07

标签: c# asp.net html

我不会说我浪费了我的时间,但花了几个小时来改变这一点。但徒劳无功。有人可以帮助我。

在以下代码中:

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

        

    <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>
    
  5. 我在这里需要1号..

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

    我想在这里2,我猜

                </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>
    

3 个答案:

答案 0 :(得分:1)

  1. 在标题td样式中使用padding-bottom以获得适当的间距。
  2. 在GridView上使用gridlines =“None”。
  3. 将网格视图和按钮放在td:s中以正确放置它们。

答案 1 :(得分:0)

这是相当基本的HTML / CSS知识(没有错),但调查基本信息来源可能会帮助你自己。

关于您的具体项目:

  • 'break'可以像控件之间的<br />语句一样简单
  • 如果您不想要颜色:#88b9c7和类似的陈述是颜色。
  • 当您使用桌子时,将网格放置在网格下方可以将它们放在正确的<tr> / <td>

答案 2 :(得分:0)

对于#1,请尝试使用margin上的paddingtd,或在span(或其他内容)中打包“禁用位置”并设置其边距/填充以提供一些空间。

对于#2,尝试在GridView上设置Gridlines="None"

对于#3,请确保<td>内有<tr>,并尝试在text-align:centertd上使用div纽扣。或者,不要把它放在表格中,只需将它们包裹在text-align:center的div中,就在桌子下面(你根本不需要桌子吗?)