【问题标题】:ASP.NET GridView Horizontal ScrollBarASP.NET GridView 水平滚动条
【发布时间】:2011-06-27 12:19:28
【问题描述】:

我见过很多类似的问题,但没有一个是这样的,所以这就是问题所在。

我有一个 AjaxControlToollkit 选项卡,在其中,我有一个 GridView。我希望 GridView 有一个滚动条,所以我可以导航

我可以添加一个滚动条,但是通过增加 GridView 的宽度(这样做是为了测试这个壮观的方案:P),GridView 会在选项卡之外增长,所以所有页面都有一个滚动条...

这就是我想要做的:

  • 在 AjaxControlToolkit 选项卡内有一个 GridView
  • 如果 GridView 有无法显示的字段,希望 GridView 能够有滚动条。

(我知道这个疑问有点奇怪,但这是我的要求)

【问题讨论】:

  • 宽度不是 100% 并且 scrollbars= auto 可以解决问题吗?

标签: asp.net gridview webforms ajaxcontroltoolkit


【解决方案1】:

只需将 GridView 用如下样式的 Div 包装起来

<div style="overflow-x:auto;width:800px">
   GridView here
</div>

【讨论】:

  • 很棒的提示!它帮助我将 GridView 包含到模态窗口中。
【解决方案2】:
<div style="overflow-x:auto">
    @Html.Grid(Model.StudentList).Named("StudentsGrid").Columns(c =>
      {
        c.Add(x => x.Name).Titled("Name").Filterable(true).Sortable(true);
        c.Add(x => x.FName).Titled("Father Name").Filterable(true).Sortable(true);
        c.Add(x => x.Class).Titled("Class").Filterable(true).Sortable(true);
        c.Add(x => x.RollNo).Titled("Roll No").Filterable(true).Sortable(true);
 
      }).WithPaging(10).EmptyText("No users found..")
</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-21
    • 2020-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-11
    • 2012-09-16
    相关资源
    最近更新 更多