开发者

Grouping together DetailsView rows?

开发者 https://www.devze.com 2023-04-05 18:23 出处:网络
If i have a DetailsView with many rows, is it possible to开发者_StackOverflow中文版 \"Group\" some of the rows together? Ie. make them seperated from the rest of the rows by using a div and some label

If i have a DetailsView with many rows, is it possible to开发者_StackOverflow中文版 "Group" some of the rows together? Ie. make them seperated from the rest of the rows by using a div and some labels or whatnot. I tried to do this but you cant add asp tags between template items. Is the only way to do this is by creating multiple DetailsView?

Thanks


This is what I did to solve similar problem with DetailsView (css styles taken from Bootstrap)

    <asp:DetailsView ID="dvID" runat="server"    
        CssClass="table table-condensed"
        GridLines="None"
        FieldHeaderStyle-Width="130px">
        <Fields>
           <asp:BoundField DataField="whatever" />
           ...
          <asp:TemplateField HeaderText="ROW"
              InsertVisible="False" AccessibleHeaderText="False"
              HeaderStyle-BackColor="#F0F0F0"
              ItemStyle-BackColor="#F0F0F0" ItemStyle-Width="99%">
              <ItemTemplate>
                  <span>&nbsp;</span>
              </ItemTemplate>
          </asp:TemplateField>

The trick is insert an empty template field with header and control having same background color to simulate empty row. You can put text/labels inside HeaderText or inside ItemTemplate or both.

0

精彩评论

暂无评论...
验证码 换一张
取 消