Grouping together DetailsView rows?
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> </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.
精彩评论