【问题标题】:Removing gap to the left of the insert fields as well as the gap between the two buttons?删除插入字段左侧的间隙以及两个按钮之间的间隙?
【发布时间】:2016-07-16 12:18:14
【问题描述】:

<asp:DetailsView ID="dtl_people" runat="server" AutoGenerateRows="False" DataKeyNames="personID" DataSourceID="dsrc_peopleObject" DefaultMode="Insert" CssClass="table-bordered table-striped" ControlStyle-Width="50%" ControlStyle-Height="200px" OnPageIndexChanging="dtl_people_PageIndexChanging" RowStyle-Wrap="False"> <FieldHeaderStyle Width="15%" /> <Fields> <asp:BoundField DataField="personID" HeaderText="personID" InsertVisible="False" ReadOnly="True" SortExpression="personID" /> <asp:BoundField DataField="lastName" HeaderText="lastName" SortExpression="lastName" ControlStyle-Width="100%"> </asp:BoundField> <asp:BoundField DataField="firstName" HeaderText="firstName" SortExpression="firstName" /> <asp:BoundField DataField="address" HeaderText="address" SortExpression="address" /> <asp:BoundField DataField="phone" HeaderText="phone" SortExpression="phone" ItemStyle-Width="350px"> <ItemStyle Width="350px"></ItemStyle> </asp:BoundField> <asp:CommandField ShowInsertButton="True" ButtonType="Button" ItemStyle-HorizontalAlign="Left" HeaderStyle-Wrap="False" /> </Fields> <InsertRowStyle Wrap="true"/> </asp:DetailsView>

我想删除按钮之间的间隙以及输入详细信息的字段左侧的间隙,谢谢

【问题讨论】:

  • 请添加一个您正在使用的剃须刀代码,然后从边距的简单 css 就可以了。
  • 修复您的图像并添加代码以显示您的问题,否则将很快被删除。
  • 如果您为此设计提供代码,您会很容易得到帮助,您尝试过什么?
  • 输入的详细代码查看

标签: asp.net detailsview


【解决方案1】:

ASP.NET DetailsView 控件的默认行为是以表格方式显示数据,没有应用填充。这意味着你有一个 CSS 样式规则某处导致这种不良行为。

幸运的是,这很容易找到:

  1. 在 Google Chrome 中运行您的网络应用程序。
  2. 按 Ctrl+Shift+I 打开开发者控制台。
  3. 单击“元素”选项卡。
  4. 右键单击页面中发生间距问题的元素,然后单击检查
  5. 仔细查看开发者控制台中的 Styles 部分,了解导致不良效果的样式规则,并在样式表文件中进行必要的更改以将其删除。

示例:

【讨论】:

    猜你喜欢
    • 2016-12-30
    • 2015-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-31
    • 1970-01-01
    • 2020-05-06
    • 2022-01-15
    相关资源
    最近更新 更多