Skip to content

Commit 9f00d95

Browse files
authored
Merge pull request #121 from FritzAndFriends/dev
Added alpha version of GridView
2 parents 0c4d1ec + dd15ae4 commit 9f00d95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1250
-68
lines changed

.github/ISSUE_TEMPLATE/use-case.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Use Case
3+
about: Sample use case for an ASPX page that should be supported
4+
title: 'Use Case:'
5+
labels: 'use case'
6+
assignees: ''
7+
8+
---
9+
10+
### Describe your usage scenario
11+
12+
### Provide some sample code to illustrate
13+
14+
```html
15+
<Sample Code Here />
16+
```

BlazorMeetsWebForms.sln

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWebFormsComponents",
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{240E45D9-B9FF-42E8-B0C1-332861E02DBF}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeforeWebForms", "samples\BeforeWebForms\BeforeWebForms.csproj", "{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}"
11-
EndProject
1210
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{FD758025-7F6D-4EE8-9837-98C0E0BFCB6B}"
1311
EndProject
1412
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWebFormsComponents.Test", "src\BlazorWebFormsComponents.Test\BlazorWebFormsComponents.Test.csproj", "{70EC4DF2-FE9B-49F4-B385-040E45BC7764}"
@@ -38,11 +36,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionInfo", "SolutionInf
3836
version.json = version.json
3937
EndProjectSection
4038
EndProject
41-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "watch", "watch", "{A4769DEE-1006-4D87-B20E-E875C556B3E8}"
42-
ProjectSection(SolutionItems) = preProject
43-
scripts\watch.csproj = scripts\watch.csproj
44-
scripts\watchtest = scripts\watchtest
45-
EndProjectSection
39+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeforeWebForms", "samples\BeforeWebForms\BeforeWebForms.csproj", "{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}"
4640
EndProject
4741
Global
4842
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -66,18 +60,6 @@ Global
6660
{7E35A14A-C0EF-4705-B892-F1704ECC6B31}.Release|x64.Build.0 = Release|Any CPU
6761
{7E35A14A-C0EF-4705-B892-F1704ECC6B31}.Release|x86.ActiveCfg = Release|Any CPU
6862
{7E35A14A-C0EF-4705-B892-F1704ECC6B31}.Release|x86.Build.0 = Release|Any CPU
69-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
70-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
71-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x64.ActiveCfg = Debug|Any CPU
72-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x64.Build.0 = Debug|Any CPU
73-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x86.ActiveCfg = Debug|Any CPU
74-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x86.Build.0 = Debug|Any CPU
75-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
76-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|Any CPU.Build.0 = Release|Any CPU
77-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x64.ActiveCfg = Release|Any CPU
78-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x64.Build.0 = Release|Any CPU
79-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x86.ActiveCfg = Release|Any CPU
80-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x86.Build.0 = Release|Any CPU
8163
{70EC4DF2-FE9B-49F4-B385-040E45BC7764}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8264
{70EC4DF2-FE9B-49F4-B385-040E45BC7764}.Debug|Any CPU.Build.0 = Debug|Any CPU
8365
{70EC4DF2-FE9B-49F4-B385-040E45BC7764}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -126,16 +108,28 @@ Global
126108
{1669CD22-5CCE-4D96-A02B-31D81B5EFB2B}.Release|x64.Build.0 = Release|Any CPU
127109
{1669CD22-5CCE-4D96-A02B-31D81B5EFB2B}.Release|x86.ActiveCfg = Release|Any CPU
128110
{1669CD22-5CCE-4D96-A02B-31D81B5EFB2B}.Release|x86.Build.0 = Release|Any CPU
111+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
112+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
113+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x64.ActiveCfg = Debug|Any CPU
114+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x64.Build.0 = Debug|Any CPU
115+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x86.ActiveCfg = Debug|Any CPU
116+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Debug|x86.Build.0 = Debug|Any CPU
117+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
118+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|Any CPU.Build.0 = Release|Any CPU
119+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x64.ActiveCfg = Release|Any CPU
120+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x64.Build.0 = Release|Any CPU
121+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x86.ActiveCfg = Release|Any CPU
122+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7}.Release|x86.Build.0 = Release|Any CPU
129123
EndGlobalSection
130124
GlobalSection(SolutionProperties) = preSolution
131125
HideSolutionNode = FALSE
132126
EndGlobalSection
133127
GlobalSection(NestedProjects) = preSolution
134-
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7} = {240E45D9-B9FF-42E8-B0C1-332861E02DBF}
135128
{70EC4DF2-FE9B-49F4-B385-040E45BC7764} = {FD758025-7F6D-4EE8-9837-98C0E0BFCB6B}
136129
{6C602B37-5FC9-43FF-A3D8-C92B42D62F0D} = {240E45D9-B9FF-42E8-B0C1-332861E02DBF}
137130
{7218D3E2-38BD-429D-9D84-15E688BDC4A1} = {240E45D9-B9FF-42E8-B0C1-332861E02DBF}
138131
{1669CD22-5CCE-4D96-A02B-31D81B5EFB2B} = {240E45D9-B9FF-42E8-B0C1-332861E02DBF}
132+
{CA277C6F-A3DD-4FAF-9B7C-56E7B844CEF7} = {240E45D9-B9FF-42E8-B0C1-332861E02DBF}
139133
EndGlobalSection
140134
GlobalSection(ExtensibilityGlobals) = postSolution
141135
SolutionGuid = {E288F9FB-039F-4718-8AEB-85F89B29EB4E}

samples/AfterBlazorServerSide/Pages/ComponentList.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<li>DataPager </li>
99
<li>DetailsView </li>
1010
<li>FormView </li>
11-
<li>GridView </li>
11+
<li><a href="/ControlSamples/GridView">GridView</a></li>
1212
<li><a href="/ControlSamples/ListView">ListView</a></li>
1313
<li><a href="/ControlSamples/Repeater">Repeater</a></li>
1414

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
@page "/ControlSamples/GridView/AutoGeneratedColumns"
2+
3+
<h2>GridView Default AutoGeneratedColumns</h2>
4+
5+
<Nav />
6+
7+
<GridView ItemType="Customer"
8+
DataKeyNames="CustomerID"
9+
SelectMethod="GetCustomers"
10+
AutogenerateColumns="true">
11+
</GridView>
12+
13+
@code{
14+
public IQueryable<Customer> GetCustomers(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount)
15+
{
16+
var customers = new List<Customer>();
17+
var c1 = new Customer
18+
{
19+
CustomerID = 1,
20+
FirstName = "John",
21+
LastName = "Smith",
22+
CompanyName = "Virus"
23+
};
24+
25+
var c2 = new Customer
26+
{
27+
CustomerID = 2,
28+
FirstName = "Jose",
29+
LastName = "Rodriguez",
30+
CompanyName = "Boring"
31+
};
32+
33+
34+
var c3 = new Customer
35+
{
36+
CustomerID = 3,
37+
FirstName = "Jason",
38+
LastName = "Ramirez",
39+
CompanyName = "Fun Machines"
40+
};
41+
42+
customers.Add(c1);
43+
customers.Add(c2);
44+
customers.Add(c3);
45+
46+
totalRowCount = customers.Count();
47+
return customers.AsQueryable();
48+
}
49+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace AfterBlazorServerSide.Pages.ControlSamples.GridView
7+
{
8+
public class Customer
9+
{
10+
public int CustomerID { get; set; }
11+
12+
public string FirstName { get; set; }
13+
14+
public string LastName { get; set; }
15+
16+
public string CompanyName { get; set; }
17+
}
18+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
@page "/ControlSamples/GridView"
2+
3+
<h2>GridView Default Example</h2>
4+
5+
<Nav />
6+
7+
<GridView ItemType="Customer"
8+
AutogenerateColumns="false"
9+
DataKeyNames="CustomerID"
10+
SelectMethod="GetCustomers"
11+
EmptyDataText="No data available">
12+
<Columns>
13+
<BoundField DataField="CustomerID" HeaderText="ID" />
14+
<BoundField DataField="CompanyName" HeaderText="CompanyName" />
15+
<BoundField DataField="FirstName" HeaderText="FirstName"/>
16+
<BoundField DataField="LastName" HeaderText="LastName"/>
17+
<TemplateField>
18+
<ItemTemplate Context="Item">
19+
<button type="button">Click Me! @Item.FirstName</button>
20+
</ItemTemplate>
21+
</TemplateField>
22+
</Columns>
23+
</GridView>
24+
25+
@code{
26+
public IQueryable<Customer> GetCustomers(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount)
27+
{
28+
var customers = new List<Customer>();
29+
var c1 = new Customer
30+
{
31+
CustomerID = 1,
32+
FirstName = "John",
33+
LastName = "Smith",
34+
CompanyName = "Virus"
35+
};
36+
37+
var c2 = new Customer
38+
{
39+
CustomerID = 2,
40+
FirstName = "Jose",
41+
LastName = "Rodriguez",
42+
CompanyName = "Boring"
43+
};
44+
45+
46+
var c3 = new Customer
47+
{
48+
CustomerID = 3,
49+
FirstName = "Jason",
50+
LastName = "Ramirez",
51+
CompanyName = "Fun Machines"
52+
};
53+
54+
customers.Add(c1);
55+
customers.Add(c2);
56+
customers.Add(c3);
57+
58+
totalRowCount = customers.Count();
59+
return customers.AsQueryable();
60+
}
61+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div>
2+
Other usage samples:
3+
<NavLink href="./ControlSamples/GridView" class="component-link" Match="NavLinkMatch.All">Simple GridView </NavLink> |
4+
<NavLink href="./ControlSamples/GridView/AutoGeneratedColumns" class="component-link" Match="NavLinkMatch.All">AutoGenerated Columns</NavLink> |
5+
<NavLink href="./ControlSamples/GridView/TemplateFields" class="component-link" Match="NavLinkMatch.All">Template Fields</NavLink> |
6+
</div>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@page "/ControlSamples/GridView/TemplateFields"
2+
3+
<h2>GridView Control</h2>
4+
5+
<Nav></Nav>
6+
7+
<GridView @ref="TemplateFieldGridView"
8+
AutogenerateColumns="false"
9+
ItemType="SharedSampleObjects.Models.Widget">
10+
<Columns>
11+
<TemplateField HeaderText="Name">
12+
<ItemTemplate Context="Item">
13+
<Label ID="lblName" Text="@Item.Name"></Label>
14+
</ItemTemplate>
15+
</TemplateField>
16+
<TemplateField HeaderText="Price">
17+
<ItemTemplate Context="Item">
18+
<Label ID="lblPrice" Text="@Item.Price"></Label>
19+
</ItemTemplate>
20+
</TemplateField>
21+
</Columns>
22+
</GridView>
23+
24+
<Button Text="Click Me!" OnClick="@Unnamed_Click" />
25+
26+
@code{
27+
28+
BlazorWebFormsComponents.GridView<Widget> TemplateFieldGridView { get; set; }
29+
30+
private static bool PriceVisibility { get; set; } = true;
31+
32+
protected override void OnAfterRender(bool firstRender)
33+
{
34+
35+
if (firstRender)
36+
{
37+
TemplateFieldGridView.DataSource = Widget.Widgets(8);
38+
TemplateFieldGridView.DataBind();
39+
}
40+
41+
base.OnAfterRender(firstRender);
42+
43+
}
44+
45+
protected void Unnamed_Click()
46+
{
47+
foreach (GridViewRow row in TemplateFieldGridView.Rows)
48+
{
49+
var label = row.FindControl("lblPrice") as Label;
50+
label.Visible = !PriceVisibility;
51+
}
52+
PriceVisibility = !PriceVisibility;
53+
}
54+
}

0 commit comments

Comments
 (0)