Skip to content

Commit aa5b835

Browse files
authored
Data list repeater column(#21) (#78)
* DataList bind item and data (#63) * (#21) implement Vertical algorithm
1 parent 8227811 commit aa5b835

30 files changed

+849
-337
lines changed

samples/AfterBlazorClientSide/Pages/Index.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
that our Blazor components render appropriately.
99
</p>
1010

11-
<ComponentList></ComponentList>
11+
<ComponentList></ComponentList>

samples/AfterBlazorClientSide/_Imports.razor

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@
77
@using AfterBlazorClientSide.Shared
88
@using BlazorWebFormsComponents
99
@using SharedSampleObjects.Models
10-
11-
@using static BlazorWebFormsComponents.Enums.RepeatLayout

samples/AfterBlazorServerSide/Pages/ControlSamples/DataList/Nav.razor

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<NavLink href="/ControlSamples/DataList/Flow" class="component-link" Match="NavLinkMatch.All">Simple Flow</NavLink> |
55
<NavLink href="/ControlSamples/DataList/HeaderStyle" class="component-link" Match="NavLinkMatch.All">Header Style</NavLink> |
66
<NavLink href="/ControlSamples/DataList/FooterStyle" class="component-link" Match="NavLinkMatch.All">Footer Style</NavLink>
7-
<NavLink href="/ControlSamples/DataList/ComplexStyle" class="component-link" Match="NavLinkMatch.All">Complex Style</NavLink>
7+
<NavLink href="/ControlSamples/DataList/ComplexStyle" class="component-link" Match="NavLinkMatch.All">Complex Style</NavLink> |
8+
<NavLink href="/ControlSamples/DataList/RepeatColumns" class="component-link" Match="NavLinkMatch.All">Repeat Columns</NavLink>
89
</div>
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
@page "/ControlSamples/DataList/RepeatColumns"
2+
3+
<h2>DataList Repeat Layout Sample</h2>
4+
5+
<Nav />
6+
<hr />
7+
<p>Here is a flow datalist bound to a collection of 9 widgets in 3 Columns layout mode.</p>
8+
9+
<DataList @ref="simpleDataList0"
10+
runat="server"
11+
EnableViewState="false"
12+
RepeatDirection="Vertical"
13+
RepeatLayout="Flow"
14+
RepeatColumns="3"
15+
GridLines="Both"
16+
Context="Item"
17+
ItemType="SharedSampleObjects.Models.Widget">
18+
<HeaderTemplate>DataList Header </HeaderTemplate>
19+
<FooterTemplate>DataList Footer </FooterTemplate>
20+
<ItemTemplate> @Item.Id</ItemTemplate>
21+
</DataList>
22+
23+
<hr />
24+
<p>Here is a flow datalist bound to a collection of 9 widgets in 3 Columns layout mode.</p>
25+
26+
<DataList @ref="simpleDataList1"
27+
runat="server"
28+
EnableViewState="false"
29+
RepeatDirection="Vertical"
30+
RepeatLayout="Flow"
31+
RepeatColumns="3"
32+
GridLines="Both"
33+
Context="Item"
34+
ItemType="SharedSampleObjects.Models.Widget">
35+
<HeaderTemplate>DataList Header </HeaderTemplate>
36+
<FooterTemplate>DataList Footer </FooterTemplate>
37+
<ItemTemplate> @Item.Id</ItemTemplate>
38+
</DataList>
39+
40+
<hr />
41+
<p>Here is a table datalist bound to a collection of 10 widgets in 4 Columns layout mode.</p>
42+
43+
<DataList @ref="simpleDataList2"
44+
runat="server"
45+
EnableViewState="false"
46+
RepeatDirection="Vertical"
47+
RepeatLayout="Table"
48+
RepeatColumns="4"
49+
GridLines="Both"
50+
Context="Item"
51+
ItemType="SharedSampleObjects.Models.Widget">
52+
<ItemTemplate>
53+
@Item.Name - @Item.Price.ToString("c")
54+
</ItemTemplate>
55+
</DataList>
56+
57+
<hr />
58+
<p>Here is a table datalist bound to a collection of 9 widgets in 3 Columns Vertically .</p>
59+
60+
<DataList @ref="simpleDataList3"
61+
runat="server"
62+
EnableViewState="false"
63+
RepeatDirection="Vertical"
64+
RepeatLayout="Table"
65+
RepeatColumns="3"
66+
GridLines="Both"
67+
Context="Item"
68+
ItemType="SharedSampleObjects.Models.Widget">
69+
<ItemTemplate>
70+
@Item.Name - @Item.Price.ToString("c")
71+
</ItemTemplate>
72+
</DataList>
73+
74+
<hr />
75+
<p>Here is a table datalist bound to a collection of 9 widgets in 3 Columns Horizontally.</p>
76+
77+
<DataList @ref="simpleDataList4"
78+
runat="server"
79+
EnableViewState="false"
80+
RepeatDirection="Horizontal"
81+
RepeatLayout="Table"
82+
RepeatColumns="3"
83+
GridLines="Both"
84+
Context="Item"
85+
ItemType="SharedSampleObjects.Models.Widget">
86+
<ItemTemplate>
87+
@Item.Name - @Item.Price.ToString("c")
88+
</ItemTemplate>
89+
</DataList>
90+
91+
<hr />
92+
<p>Here is a table datalist bound to a collection of 4 widgets in No Columns Horizontally.</p>
93+
94+
<DataList @ref="simpleDataList5"
95+
runat="server"
96+
EnableViewState="false"
97+
RepeatDirection="Horizontal"
98+
RepeatLayout="Table"
99+
GridLines="Both"
100+
Context="Item"
101+
ItemType="SharedSampleObjects.Models.Widget">
102+
<ItemTemplate>
103+
@Item.Name - @Item.Price.ToString("c")
104+
</ItemTemplate>
105+
</DataList>
106+
107+
@code {
108+
BlazorWebFormsComponents.DataList<Widget> simpleDataList0 { get; set; }
109+
BlazorWebFormsComponents.DataList<Widget> simpleDataList1 { get; set; }
110+
BlazorWebFormsComponents.DataList<Widget> simpleDataList2 { get; set; }
111+
BlazorWebFormsComponents.DataList<Widget> simpleDataList3 { get; set; }
112+
BlazorWebFormsComponents.DataList<Widget> simpleDataList4 { get; set; }
113+
BlazorWebFormsComponents.DataList<Widget> simpleDataList5 { get; set; }
114+
115+
protected override void OnAfterRender(bool firstRender)
116+
{
117+
if (firstRender)
118+
{
119+
simpleDataList0.DataSource = Widget.Widgets(9);
120+
simpleDataList1.DataSource = Widget.Widgets(9);
121+
simpleDataList2.DataSource = Widget.Widgets(10);
122+
simpleDataList3.DataSource = Widget.Widgets(9);
123+
simpleDataList4.DataSource = Widget.Widgets(9);
124+
simpleDataList5.DataSource = Widget.Widgets(4);
125+
simpleDataList0.DataBind();
126+
simpleDataList1.DataBind();
127+
simpleDataList2.DataBind();
128+
simpleDataList3.DataBind();
129+
simpleDataList4.DataBind();
130+
simpleDataList5.DataBind();
131+
}
132+
base.OnAfterRender(firstRender);
133+
}
134+
}

samples/AfterBlazorServerSide/Pages/ControlSamples/DataList/SimpleFlow.razor

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
<p>Here is a simple datalist bound to a collection of widgets in Flow layout mode.</p>
88

9-
<DataList @ref="simpleDataList"
10-
runat="server"
11-
EnableViewState="false"
12-
RepeatLayout="Flow"
13-
Context="Item"
14-
ItemType="SharedSampleObjects.Models.Widget">
15-
<HeaderTemplate>Simple Widgets</HeaderTemplate>
16-
<ItemTemplate>
17-
@Item.Name - @Item.Price.ToString("c")
18-
</ItemTemplate>
19-
</DataList>
9+
<DataList @ref="simpleDataList"
10+
runat="server"
11+
EnableViewState="false"
12+
RepeatLayout="Flow"
13+
Context="Item"
14+
ItemType="SharedSampleObjects.Models.Widget">
15+
<HeaderTemplate>Simple Widgets</HeaderTemplate>
16+
<ItemTemplate>
17+
@Item.Name - @Item.Price.ToString("c")
18+
</ItemTemplate>
19+
</DataList>
2020

2121
@code {
2222

@@ -25,16 +25,17 @@
2525
protected override void OnAfterRender(bool firstRender)
2626
{
2727

28-
if (firstRender)
29-
{
30-
simpleDataList.DataSource = Widget.SimpleWidgetList;
31-
simpleDataList.DataBind();
32-
}
28+
if (firstRender)
29+
{
30+
simpleDataList.DataSource = Widget.SimpleWidgetList;
31+
simpleDataList.DataBind();
32+
}
3333

34-
//base.OnParametersSet();
35-
base.OnAfterRender(firstRender);
34+
//base.OnParametersSet();
35+
base.OnAfterRender(firstRender);
3636

3737
}
3838

3939
}
4040

41+

samples/AfterBlazorServerSide/Pages/ControlSamples/_Imports.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
@using SharedSampleObjects.Models
33

44
@using static BlazorWebFormsComponents.Enums.RepeatLayout
5+
@using static BlazorWebFormsComponents.Enums.DataListEnum
56
@using static BlazorWebFormsComponents.Enums.ValidationSummaryDisplayMode
67
@using static BlazorWebFormsComponents.Enums.ButtonType

samples/AfterBlazorServerSide/Shared/NavMenu.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<TreeNode NavigateUrl="/ControlSamples/DataList/HeaderStyle" Text="Header Style" />
2222
<TreeNode NavigateUrl="/ControlSamples/DataList/FooterStyle" Text="Footer Style" />
2323
<TreeNode NavigateUrl="/ControlSamples/DataList/ComplexStyle" Text="Complex Style" />
24+
<TreeNode NavigateUrl="/ControlSamples/DataList/RepeatColumns" Text="Repeat Columns" />
2425
</TreeNode>
2526

2627
<TreeNode Text="ListView" NavigateUrl="/ControlSamples/ListView">

samples/BeforeWebForms/BeforeWebForms.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ProductVersion>
99
</ProductVersion>
1010
<SchemaVersion>2.0</SchemaVersion>
11-
<RuntimeIdentifiers>win</RuntimeIdentifiers>
11+
<RuntimeIdentifiers>win</RuntimeIdentifiers>
1212
<ProjectGuid>{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}</ProjectGuid>
1313
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1414
<OutputType>Library</OutputType>
@@ -109,6 +109,7 @@
109109
<Content Include="Content\bootstrap.css" />
110110
<Content Include="Content\bootstrap.min.css" />
111111
<Content Include="Content\Site.css" />
112+
<Content Include="ControlSamples\DataList\RepeatColumns.aspx" />
112113
<Content Include="ControlSamples\DataList\StyleAttributes.aspx" />
113114
<Content Include="ControlSamples\DataList\FlowLayout.aspx" />
114115
<Content Include="ControlSamples\DataList\Default.aspx" />
@@ -166,6 +167,13 @@
166167
<ItemGroup>
167168
<Compile Include="App_Start\BundleConfig.cs" />
168169
<Compile Include="App_Start\RouteConfig.cs" />
170+
<Compile Include="ControlSamples\DataList\RepeatColumns.aspx.cs">
171+
<DependentUpon>RepeatColumns.aspx</DependentUpon>
172+
<SubType>ASPXCodeBehind</SubType>
173+
</Compile>
174+
<Compile Include="ControlSamples\DataList\RepeatColumns.aspx.designer.cs">
175+
<DependentUpon>RepeatColumns.aspx</DependentUpon>
176+
</Compile>
169177
<Compile Include="ControlSamples\DataList\StyleAttributes.aspx.cs">
170178
<DependentUpon>StyleAttributes.aspx</DependentUpon>
171179
<SubType>ASPXCodeBehind</SubType>
@@ -308,4 +316,4 @@
308316
<Target Name="AfterBuild">
309317
</Target>
310318
-->
311-
</Project>
319+
</Project>

samples/BeforeWebForms/ControlSamples/DataList/Default.aspx

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,39 @@
55
<h2>DataList control homepage</h2>
66

77
<div>
8-
Other usage samples: <a href="FlowLayout.aspx">FlowLayout Sample</a> <a href="StyleAttributes.aspx">Styles</a>
8+
usage samples <a href="Default.aspx">Default Sample</a>|<a href="FlowLayout.aspx">FlowLayout Sample</a>|<a href="StyleAttributes.aspx">Styles</a>|<a href="RepeatColumns.aspx">Repeat Columns Sample</a>
99
</div>
1010

11-
<p>Here is a simple datalist bound to a collection of widgets. By default, the RepeatLayout
11+
<p>
12+
Here is a simple datalist bound to a collection of widgets. By default, the RepeatLayout
1213
is a Table.
1314
</p>
1415

15-
<asp:DataList ID="simpleDataList"
16-
runat="server"
17-
RepeatColumns="1"
18-
ToolTip="This is my tooltip"
19-
UseAccessibleHeader="true"
20-
Caption="This is my caption"
21-
CaptionAlign="Top"
22-
CellPadding="2"
23-
CellSpacing="3"
24-
TabIndex="1"
25-
ItemType="SharedSampleObjects.Models.Widget">
26-
<HeaderStyle CssClass="myClass" Wrap="true" Font-Bold="true" Font-Italic="true" Font-Names="arial black" Font-Overline="true" Font-Size="X-Large" Font-Strikeout="true" Font-Underline="true" />
27-
<HeaderTemplate>
28-
My Widget List
29-
</HeaderTemplate>
30-
<FooterTemplate>End of Line</FooterTemplate>
31-
<ItemTemplate>
32-
<%# Item.Name %>
33-
<br />
34-
<%# Item.Price.ToString("c") %>
35-
</ItemTemplate>
36-
<SeparatorTemplate>Hi! I'm a separator! I keep things apart</SeparatorTemplate>
37-
<ItemStyle BackColor="Yellow" Wrap="false" />
38-
<AlternatingItemStyle BackColor="Wheat" />
39-
<SeparatorStyle BackColor="Black" ForeColor="PapayaWhip" />
40-
</asp:DataList>
16+
<asp:DataList ID="simpleDataList"
17+
runat="server"
18+
RepeatColumns="1"
19+
ToolTip="This is my tooltip"
20+
UseAccessibleHeader="true"
21+
Caption="This is my caption"
22+
CaptionAlign="Top"
23+
CellPadding="2"
24+
CellSpacing="3"
25+
TabIndex="1"
26+
ItemType="SharedSampleObjects.Models.Widget">
27+
<HeaderStyle CssClass="myClass" Wrap="true" Font-Bold="true" Font-Italic="true" Font-Names="arial black" Font-Overline="true" Font-Size="X-Large" Font-Strikeout="true" Font-Underline="true" />
28+
<HeaderTemplate>
29+
My Widget List
30+
</HeaderTemplate>
31+
<FooterTemplate>End of Line</FooterTemplate>
32+
<ItemTemplate>
33+
<%# Item.Name %>
34+
<br />
35+
<%# Item.Price.ToString("c") %>
36+
</ItemTemplate>
37+
<SeparatorTemplate>Hi! I'm a separator! I keep things apart</SeparatorTemplate>
38+
<ItemStyle BackColor="Yellow" Wrap="false" />
39+
<AlternatingItemStyle BackColor="Wheat" />
40+
<SeparatorStyle BackColor="Black" ForeColor="PapayaWhip" />
41+
</asp:DataList>
4142

4243
</asp:Content>

samples/BeforeWebForms/ControlSamples/DataList/FlowLayout.aspx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22

33
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
44

5-
<h2>DataList Flow Layout Sample</h2>
5+
<h2>DataList Flow Layout Sample</h2>
66

7-
<div>
8-
Other usage samples: <a href="Default.aspx">Simple Layout Sample</a> <a href="StyleAttributes.aspx">Styles</a>
9-
</div>
7+
<div>
8+
usage samples <a href="Default.aspx">Default Sample</a>|<a href="FlowLayout.aspx">FlowLayout Sample</a>|<a href="StyleAttributes.aspx">Styles</a>|<a href="RepeatColumns.aspx">Repeat Columns Sample</a>
9+
</div>
1010

11-
<p>Here is a simple datalist bound to a collection of widgets with RepeatLayout set to Flow</p>
11+
<p>Here is a simple datalist bound to a collection of widgets with RepeatLayout set to Flow</p>
1212

13-
<asp:DataList ID="simpleDataList"
14-
runat="server"
15-
Enabled="true"
16-
Caption="This is my caption"
17-
CaptionAlign="Top"
18-
CellPadding="2"
19-
CellSpacing="3"
20-
ToolTip="This is my tooltip"
21-
UseAccessibleHeader="true"
22-
RepeatLayout="Flow"
23-
ItemType="SharedSampleObjects.Models.Widget">
24-
<HeaderStyle />
25-
<HeaderTemplate>
26-
My Widget List
27-
</HeaderTemplate>
28-
<ItemTemplate>
29-
<%# Item.Name %>
30-
<br />
31-
<%# Item.Price.ToString("c") %>
32-
</ItemTemplate>
33-
</asp:DataList>
13+
<asp:DataList ID="simpleDataList"
14+
runat="server"
15+
Enabled="true"
16+
Caption="This is my caption"
17+
CaptionAlign="Top"
18+
CellPadding="2"
19+
CellSpacing="3"
20+
ToolTip="This is my tooltip"
21+
UseAccessibleHeader="true"
22+
RepeatLayout="Flow"
23+
ItemType="SharedSampleObjects.Models.Widget">
24+
<HeaderStyle />
25+
<HeaderTemplate>
26+
My Widget List
27+
</HeaderTemplate>
28+
<ItemTemplate>
29+
<%# Item.Name %>
30+
<br />
31+
<%# Item.Price.ToString("c") %>
32+
</ItemTemplate>
33+
</asp:DataList>
3434

3535
</asp:Content>

0 commit comments

Comments
 (0)