我想减少asp.net webform中的间距

时间:2009-11-18 15:04:30

标签: asp.net html css

我想减少网页内的间距:

问题是“后退”下方的按钮和“下一步”不向下滚动

我已经发布了以下代码:

 <asp:View runat="server" ID="view_1">
                <asp:ScriptManager ID="scrMgr" runat="server">
                </asp:ScriptManager>
                <h1 class="blue" style="margin-bottom:0px;">
                    <asp:Label ID="lbl_viewTitle1" runat="server" Text="Label"></asp:Label>
                </h1>
                <div style="margin:0px; padding:0px; border:none; clear:both;">
                <table border="0">
                    <tr>
                        <td>
                            <table border="1" style="border-color: Green; border-width: thin;">
                                <tr>
                                    <td valign="top" id="tdReadableContent" runat="server">
                                        <div style="height: 167px; width:450px;">
                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                <tr>
                                                    <td class="blue" style="height:16px!important;" colspan="3"><b>Your Current Settings</b></td>
                                                </tr>
                                                <tr style="width:10px"><td colspan="3"></td></tr>
                                                <tr id="trUserDetail_read" runat="server">
                                                    <td class="tabRow" valign="baseline">
                                                        <asp:Label ID="lbl_view1_userID_Read" runat="server" Text="User ID"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txt_view1_userID_Read" ReadOnly="true" runat="server" AutoPostBack="true" 
                                                        CssClass="text_box_gray"></asp:TextBox><div class="smallText" nowrap>
                                                            &nbsp;&nbsp;<%--(This would be the ID you would normally log on with.)--%></div>
                                                    </td>
                                                    <td>&nbsp;</td>
                                                </tr>

                                                <tr>
                                                    <td width="150" class="tabRow">
                                                        <asp:Label ID="lbl_panview3_label2_read" runat="server" Text="Store Number "></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txt_panview3_input2_read" CssClass="text_box_gray" ReadOnly="true" runat="server" MaxLength="4"></asp:TextBox>
                                                    </td>
                                                    <td>&nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td class="tabRow">
                                                        <asp:Label ID="lbl_view1_surname_read" runat="server" Text="Surname"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txt_view1_surname_read" ReadOnly="true" CssClass="text_box_gray" runat="server"></asp:TextBox>
                                                    </td>
                                                    <td>&nbsp;</td>
                                                </tr>

                                                <tr id="trFirstName_Read" runat="server">
                                                    <td width="150" class="tabRow">
                                                        <asp:Label ID="lbl_view1_firstName_Read" runat="server" Text="First Name"></asp:Label>
                                                    </td>
                                                    <td width="200">
                                                        <asp:TextBox ID="txt_view1_firstname_Read" ReadOnly="true" runat="server" CssClass="text_box_gray"></asp:TextBox>
                                                    </td>
                                                    <td>&nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td></td>
                                                    <td>
                                                        &nbsp;&nbsp;
                                                        <%--<asp:Label ID="Label1" CssClass="errorText" runat="server"></asp:Label>--%>
                                                    </td>    
                                                </tr>
                                                <tr>
                                                    <td class="tabRow">&nbsp;
                                                        <%--<asp:Label ID="Label2" runat="server" Text="Employee Number "></asp:Label>--%>
                                                    </td>
                                                    <td width="200">&nbsp;
                                                        <%--<asp:TextBox ID="TextBox1" runat="server" 
                                                        CssClass="text_box_3" MaxLength="10"></asp:TextBox>--%>
                                                    </td>
                                                </tr>    
                                            </table>
                                        </div>
                                        <asp:Label runat="server" ID="label11"></asp:Label>
                                        <hr class="hrRequestorForm" />
                                        <div id="divRoleDepartment_ReadOnly" runat="server" style="margin-left:20px; height:390px; overflow:auto;" class="tabel1Parent">
                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                <tr>
                                                    <td>
                                                        <asp:Panel ID="panelStore_Read" runat="server">
                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td valign="top">
                                                                        <asp:GridView ID="gvRoleDepartment_ReadOnly" runat="server" AutoGenerateColumns="false">
                                                                            <Columns>
                                                                            <asp:TemplateField>
                                                                                        <ItemTemplate>
                                                                                            <asp:CheckBox ID="chkRole_Read" runat="server" Enabled="false" />
                                                                                            <input type="hidden" id="hdRoleCode_Read" value="<%#Bind('ddl_code') %>" runat="server" />
                                                                                            <input type="hidden" id='hdDepCode_Read' value="<%#Bind('dep_code') %>" runat="server" />
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                <asp:BoundField DataField="ddl_item" HeaderText="Role" ItemStyle-CssClass="roleColumn2" />
                                                                                <asp:BoundField DataField="dep_name" HeaderText="Department" ItemStyle-CssClass="departmentColumn" />
                                                                            </Columns>
                                                                            <EmptyDataTemplate>
                                                                                <div class="tabel1Parent">
                                                                                <table border='0' cellpadding='0' cellspacing='0' style='border-color: green; border-width: thin;
                                                                                    width: 390px; border-left: #9787b1 solid 1px; border-top: #9787b1 solid 1px;'>
                                                                                    <tr>
                                                                                        <td class='roleColumn'>
                                                                                            <b>Role</b>
                                                                                        </td>
                                                                                        <td class='departmentColumn'>
                                                                                            <b>Department</b>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                                </div>
                                                                            </EmptyDataTemplate>
                                                                        </asp:GridView>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td valign="top">
                                                                        &nbsp;
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </asp:Panel>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                    <td valign="top" >
                                        <div style="height:160px; width:450px;"> 
                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                <tr>
                                                    <td class="blue" style="height:16px!important;" colspan="3"><b>
                                                    <asp:Label ID="lblNewSettings" runat='server' Text="Your New Settings"></asp:Label> 
                                                    </b></td>
                                                </tr>
                                                <tr id="trUserDetail" runat="server">
                                                    <td class="tabRow" valign="baseline">
                                                        <asp:Label ID="lbl_view1_userID" runat="server" Text="User ID "></asp:Label>
                                                    </td>
                                                    <td class="textFieldColumn">
                                                        <asp:TextBox ID="txtUserID" TabIndex="1" text="Enter User id.." 
                                                            runat="server" AutoPostBack="true" 
                                                            CssClass="text_box_highlight"
                                                            onfocus="defaultStyle();"
                                                            onkeypress="ChangeUserIdBackground();"
                                                            MaxLength ="50"></asp:TextBox><span id="starUserId" runat="server" style="color:Red">&nbsp;*</span>
                                                            <asp:RequiredFieldValidator ID="rfvUserID"  runat="server" ControlToValidate="txtUserID"
                                                            ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator><div class="smallText" nowrap>
                                                            &nbsp;&nbsp;(This would be the ID you would normally log on with.)</div></td>

                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="padding-left:135px">
                                                        <asp:Label ID="lblUserExists" CssClass="errorText" runat="server"></asp:Label>
                                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                                                            ControlToValidate="txt_panview3_input2" ErrorMessage="Store should be a number" 
                                                            ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
                                                    </td>    
                                                </tr>
                                                <tr>
                                                    <td width="150" class="tabRow">
                                                        <asp:Label ID="lbl_panview3_label2" runat="server" Text="Store Number "></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txt_panview3_input2" runat="server" 
                                                        MaxLength="4" CssClass="text_box_3">0000</asp:TextBox>
                                                        <span id="starStoreNumber" runat="server" style="color:Red">&nbsp;*</span>
                                                        <asp:RequiredFieldValidator ID="rfvStoreNumber" runat="server" 
                                                        ControlToValidate="txt_panview3_input2" ErrorMessage=" Required field" 
                                                        ValidationGroup="Form2" ></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tabRow">
                                                        <asp:Label ID="lbl_view1_surname" runat="server" Text="Surname "></asp:Label>
                                                    </td>
                                                    <td >
                                                        <asp:TextBox ID="txt_view1_surname" runat="server" 
                                                            CssClass="text_box_3"
                                                            MaxLength ="50"></asp:TextBox>
                                                            <span id="starSurName" runat="server" style="color:Red">&nbsp;*</span>
                                                        <asp:RequiredFieldValidator ID="rfvSurName" runat="server" ControlToValidate="txt_view1_surname"
                                                            ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>

                                                    </td>
                                                </tr>
                                                <tr id="trFirstName" runat="server">
                                                    <td width="150" class="tabRow">
                                                        <asp:Label ID="lbl_view1_firstName" runat="server" Text="First Name"></asp:Label>
                                                    </td>
                                                    <td >
                                                        <asp:TextBox ID="txt_view1_firstname" runat="server" 
                                                            CssClass="text_box_3"
                                                            MaxLength ="50"></asp:TextBox>
                                                            <span id="starFirstName" runat="server" style="color:Red">&nbsp;*</span>
                                                            <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="txt_view1_firstname"
                                                            ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tabRow">
                                                        <asp:Label ID="lblEmployeeNumber" runat="server" Text="Employee Number "></asp:Label>
                                                    </td>
                                                    <td width="280">
                                                        <asp:TextBox ID="txtEmployeeNumber" runat="server" 
                                                        CssClass="text_box_3" MaxLength="6"></asp:TextBox>
                                                        <span id="starEmployeeNumber" runat="server" style="color:Red">&nbsp;*</span>
                                                        <asp:RequiredFieldValidator ID="rfvEmplyeeNumber" runat="server" ControlToValidate="txtEmployeeNumber"
                                                            ErrorMessage="Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
                                                    </td>
                                                    <td>
                                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                                                        ControlToValidate="txtEmployeeNumber" ErrorMessage="Enter a numeric value" 
                                                        ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
                                                    </td>
                                                </tr>                                                
                                            </table>
                                            <b><asp:Label ID="lblCaption2" runat="server" Text="Note: All fields are mandatory" ForeColor="Red"></asp:Label></b>
                                        </div>
                                        <hr class="hrRequestorForm" />
                                        <div style="padding-left:20px;" id="divRoleDepartment" runat="server">
                                            <div class="tabel1Parent">
                                                <table border="0" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                        <td>
                                                            <asp:Panel ID="panelStore" runat="server">
                                                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                    <tr>
                                                                        <td valign="top">
                                                                            <asp:GridView ID="gvRoleDepartment" runat="server" AutoGenerateColumns="false">
                                                                                <Columns>
                                                                                    <asp:TemplateField>
                                                                                        <ItemTemplate>
                                                                                            <asp:CheckBox ID="chkRole" runat="server" />
                                                                                            <input id="hdRoleCode" runat="server" type="hidden" 
                                                                                                value="<%#Bind('ddl_code') %>" />
                                                                                            <input id="hdDepCode" runat="server" type="hidden" 
                                                                                                value="<%#Bind('dep_code') %>" />
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:BoundField ControlStyle-CssClass="roleColumn" ControlStyle-Width="300px" 
                                                                                        DataField="ddl_item" HeaderText="Role" ItemStyle-CssClass="roleColumn" />
                                                                                    <asp:BoundField ControlStyle-CssClass="departmentColumn" 
                                                                                        ControlStyle-Width="120px" DataField="dep_name" HeaderText="Department" 
                                                                                        ItemStyle-CssClass="departmentColumn" />
                                                                                </Columns>
                                                                            </asp:GridView>
                                                                            <span ID="lbl_chkBx_store_workunit" class="errorText"></span>
                                                                        </td>
                                                                        <td>
                                                                            &nbsp;
                                                                        </td>
                                                                    </tr>

                                                                </table>
                                                            </asp:Panel>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <br />
                                            <div>
                                                <table>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblException" runat="server" CssClass="errorText"></asp:Label>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <br />
                                        </div>
                                    </td>                                    
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <br />
                            <div>
                                <table>
                                    <tr>
                                        <td>
                                            <asp:Button ID="btn_view1_back" runat="server" Text="Back" CausesValidation="False"
                                                ValidationGroup="Form2" />
                                            <asp:Button ID="btn_View1_Next" runat="server" CausesValidation="true" Text="Next"
                                                ValidationGroup="Form2" OnClientClick="return check_sel();" UseSubmitBehavior="True" />
                                            <%
                                                'mahesh code
                                                'replaced   OnClientClick="return ValidateDropDown(); with OnClientClick="return check_sel() "  
                                            %>
                                        </td>
                                    </tr>
                                </table>
                            </div>  
                            <br />
                        </td>
                    </tr>
                </table>
                </div>
            </asp:View>

请帮助@!

3 个答案:

答案 0 :(得分:3)

你说你的问题是按钮不在视图中。您可以按using this technique将控件滚动到视图中。或者您可以在我的屏幕上加载页面,我有一个更大的显示器。

我想说的是:如果重新设计后在屏幕上显示,屏幕较小或浏览器窗口调整大小的人仍然无法看到它。

如果您想要对HTML设计提供专业帮助,我建议您上传一个我们可以复制并粘贴测试的问题(或显示当前页面的在线链接)的问题示例

答案 1 :(得分:2)

丢失表格,或至少删除不必要的<div><br>代码。

答案 2 :(得分:0)

另一个选项,如果您不必支持旧版本的Internet Explorer,则使用position:fixed将您的按钮“粘贴”到可查看窗口的底部。

<div style="position: fixed; bottom: 0px;">
    <asp:Button ID="btn_view1_back" ... /> 
    <asp:Button ID="btn_view1_next" ... />
</div>