简体   繁体   English

asp.net数据控件

[英]asp.net data controls

I have a table with the following structure, 我有一个具有以下结构的表,

在此处输入图片说明

I need to restructure the table to show the CustomSpaceName in the following order, 我需要重组表以按以下顺序显示CustomSpaceName

Space3          Personal Case           Quick case

Space1          Space2

For each entry I will create a link button and pass the CustomSpaceId in query string. 对于每个条目,我将创建一个链接按钮并在查询字符串中传递CustomSpaceId

So which is the ASP.NET Data Control matches best with my requirement. 因此,哪种ASP.NET数据控件最符合我的要求。 I think using the loop and generate table structure is a BAD idea. 我认为使用循环并生成表结构是一个糟糕的主意。

No Need of doing that with a old method when ASP.net gives you GridView and other Data Bounding controls 当ASP.net为您提供GridView和其他数据边界控件时,无需使用旧方法进行操作

Basically gridview will do the same operation that you told in a efficient way. 基本上,gridview将执行您以有效方式告诉您的相同操作。 You can use the in-built methods. 您可以使用内置方法。

  1. Grid View 网格视图
  2. Repeater 直放站
  3. ListView 列表显示
  4. DataList 数据清单

Here I will recommend DataList . 在这里,我将推荐DataList Use RepeatColumns="4" property. 使用RepeatColumns="4"属性。

<asp:DataList ID="DataList1" RepeatColumns="4" runat="server">
            <HeaderTemplate>
                <asp:Label runat="server" ID="lbl1" Text='Header'></asp:Label>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label runat="server" ID="lbl1" Text='<% Eval("CustomSpaceName ") %>'></asp:Label>
            </ItemTemplate>
        </asp:DataList>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM