我可以显示包含行的数据网格吗? [英] Can I show a datagrid with a wrapped row?

查看:82
本文介绍了我可以显示包含行的数据网格吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些包含一些列的数据网格。其中一个宽度很大。在运行时,我看到带有滚动条的网格,我可以向左滚动以查看整个网格。

我希望网格没有滚动条,每行包裹在一个新行中。

这有可能吗?

I have a datagrid with some columns. One of it has a big width. At runtime I see the grid with a scrollbar and I can scroll left an right to see the whole grid.
I like to have that the grid has no scrollbar and each row is wrapped in a new line.
Is this somehow possible?

推荐答案

我非常确定没有一个网格视图可以做到这一点:它已经超越了这种控制的本质。



所有你能做的就是开发你自己的自定义控件,但我不建议它,它会强烈挫败目的网格视图会极大地混淆用户,包括你自己。想象一下它的样子。在你看来,你喜欢拥有。把它画在纸上,屏幕上或想象中,你很快就会发现你根本不喜欢它。更好地考虑较窄网格的设计,也许还有某种向下钻取,点击,上下文菜单或某种方式。



-SA
I am pretty much sure that none of the grid views can do it: it''s beyond the nature of such controls.

All you can do is developing of your own custom control, but I don''t advices it, it would strongly defeat the purpose of the grid view and would greatly confuse the users, including yourself. Just imagine it''s look. It only seems to you that you "like to have". Draw it on paper, screen, or in your imagination, and you will quickly see that you won''t like it at all. Better think on the design of narrower grid and perhaps some kind of "drill down", on click, context menu or somehow.

—SA


Hi

You can wrap the text in grid.

You have to follow the below steps: 





1. GridView宽度应为百分比(宽度=100 %)

2.同样地,你必须给出列宽(ItemStyle-Width =10%HeaderStyle-Width =10%)

3 。设置ItemStyle-Wrap =true用于包装文本

4.所有cilumns的总和宽度必须等于100%



示例



1. GridView width should be in precentage (Width="100%")
2. In the same way you have to give column width (ItemStyle-Width="10%" HeaderStyle-Width="10%")
3. Set ItemStyle-Wrap="true" for wrapping the text
4. Sum of all cilumns width must be equal to 100%

Example

<asp:GridView ID="gvDetails" runat="server" AutoGenerateColumns="False"

        GridLines="Vertical" Width="100%">
        <Columns>
            <asp:TemplateField HeaderText="Remarks" ItemStyle-Wrap="true" ItemStyle-Width="80%" HeaderStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label ID="lblRemarks" runat="server" Text='<%# Bind("REMARKS") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Customer" ItemStyle-Width="10%" HeaderStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label ID="lblCustomerName" runat="server" Text='<%# Bind("CUSTOMERNAME") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Status" ItemStyle-Width="10%" HeaderStyle-Width="6%">
                <ItemTemplate>
                    <asp:Label ID="lblSts" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>





问候

Willington



Regards
Willington


谢谢你的答案。

包装文字的想法我不喜欢它因为行高。

要么我有一个固定行高三倍比正常显示所有内容或

我有自动行高,然后我有一个颠簸的视图取决于描述列是否被包裹。



这个示例显示我喜欢的内容:



>>
  Pos  &NBSP;数量&NBSP; &NBSP; UNITPRICE&NBSP; &NBSP;单元&NBSP; &NBSP;折扣&NBSP; &NBSP;采购订单编号  总计 
描述
  1 &NBSP; 3 &NBSP; 5.00 &NBSP; PC &NBSP; 50% &NBSP; 4512345678    7.50
Chewingum
  2 < /td> 2 2.00 Pc 10% 4587654321  ;   3.60
Lollypop甜酸和樱桃咖喱的风味味道




我会尝试通过复制每一行来实现它,使DataGridCells交替显示或不是

和组行Pos专栏。

欢迎任何批评和建议
Thanks for your answers.
The idea with wrapping the text I don''t like it because of the row height.
Either I have a fixed row height three times higher than normal to show all contents or
I have auto row height then I have a bumpy view depending if description column is wrapped.

This example shows what I like to have:

>>
 Pos  Quantity  Unitprice  Unit  Discount  PO Number Total 
Description
 1 3 5.00 Pc 50% 4512345678  7.50
Chewingum
 2 2 2.00 Pc 10% 4587654321  3.60
Lollypop sweet sour and cherry curry hot style taste


I will try to realize it by duplicate each row, make DataGridCells alternating visible or not
and group rows by Pos column.
Any criticism and suggestion are welcome


这篇关于我可以显示包含行的数据网格吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆