Skip to content

Commit 68fcd12

Browse files
Merge pull request #1 from Backiaraj/grid
Update the project from older version to latest version (using .NET 7 Framework)
2 parents e728563 + e3f065f commit 68fcd12

Some content is hidden

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

64 files changed

+641
-2451
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
8+
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
13+
<PackageReference Include="Syncfusion.Blazor.Calendars" Version="24.1.45" />
14+
<PackageReference Include="Syncfusion.Blazor.DropDowns" Version="24.1.45" />
15+
<PackageReference Include="Syncfusion.Blazor.Grid" Version="24.1.45" />
16+
<PackageReference Include="Syncfusion.Blazor.Inputs" Version="24.1.45" />
17+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="24.1.45" />
18+
</ItemGroup>
19+
20+
</Project>

Validation_GridDialogTemplate/Pages/DataGridFeatures.razor renamed to DisplayValidationMessage.Client/Pages/Counter.razor

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
@page "/datagrid-features"
1+
@page "/counter"
2+
@rendermode InteractiveAuto
23

34
@using Syncfusion.Blazor.Grids
45
@using Syncfusion.Blazor.Calendars
56
@using Syncfusion.Blazor.DropDowns
67
@using Syncfusion.Blazor.Inputs
78
@using System.ComponentModel.DataAnnotations
9+
810
<SfGrid DataSource="@GridData" Toolbar="@(new string[] {"Add", "Edit" ,"Delete","Update","Cancel" })">
911
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Dialog">
1012
<Validator>
@@ -14,6 +16,9 @@
1416
@{
1517
var Order = (context as OrdersDetails);
1618
<div>
19+
<ValidationMessage For="() => Order.OrderID" />
20+
<ValidationMessage For="() => Order.OrderDate" />
21+
<ValidationMessage For="() => Order.CustomerID" />
1722
<ValidationMessage For="() => Order.ShipCountry" />
1823
<ValidationMessage For="() => Order.ShipAddress" />
1924
<div class="form-row">
@@ -70,7 +75,36 @@
7075
<GridColumn Field=@nameof(OrdersDetails.ShipCountry) HeaderText="Ship Country" Width="150"></GridColumn>
7176
</GridColumns>
7277
</SfGrid>
73-
@code{
78+
79+
@* <style>
80+
.form-group {
81+
margin-bottom: 1rem;
82+
}
83+
84+
.form-inline .form-control {
85+
display: inline-block;
86+
width: auto;
87+
vertical-align: middle;
88+
}
89+
90+
.form-row {
91+
display: flex;
92+
flex-wrap: wrap;
93+
margin-right: -5px;
94+
margin-left: -5px;
95+
}
96+
97+
.form-row > .col {
98+
padding-left: 5px;
99+
padding-right: 5px;
100+
}
101+
102+
label {
103+
margin-bottom: 0.5rem;
104+
}
105+
</style> *@
106+
107+
@code {
74108
public List<OrdersDetails> GridData = new List<OrdersDetails>
75109
{
76110
new OrdersDetails() { OrderID = 10248, CustomerID = "VINET", Freight = 32.38, ShipCity = "Berlin", OrderDate = DateTime.Now.AddDays(-2), ShipName = "Vins et alcools Chevalier", ShipCountry = "Denmark", ShipAddress = "Kirchgasse 6" },
@@ -84,17 +118,23 @@
84118
new OrdersDetails() { OrderID = 10256, CustomerID = "WELLI", Freight = 13.97, ShipCity = "Madrid", OrderDate = DateTime.Now.AddDays(-43), ShipName = "Wellington Importadora", ShipCountry = "Brazil", ShipAddress = "Avda. Azteca 123" },
85119
new OrdersDetails() { OrderID = 10257, CustomerID = "HILAA", Freight = 81.91, ShipCity = "Cholchester", OrderDate = DateTime.Now.AddDays(-48), ShipName = "HILARION-Abastos", ShipCountry = "Germany", ShipAddress = "Carrera 52 con Ave. Bolívar #65-98 Llano Largo" }
86120
};
121+
87122
public class OrdersDetails
88123
{
124+
[Required]
89125
public int? OrderID { get; set; }
126+
[Required]
90127
public string CustomerID { get; set; }
128+
[Required]
91129
public double? Freight { get; set; }
130+
[Required]
92131
public string ShipCity { get; set; }
132+
[Required]
93133
public DateTime OrderDate { get; set; }
94134
public string ShipName { get; set; }
95135
[Required]
96136
public string ShipCountry { get; set; }
97137
[Required]
98138
public string ShipAddress { get; set; }
99139
}
100-
}
140+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
2+
using Syncfusion.Blazor;
3+
4+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
5+
builder.Services.AddSyncfusionBlazor();
6+
await builder.Build().RunAsync();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@using System.Net.Http
2+
@using System.Net.Http.Json
3+
@using Microsoft.AspNetCore.Components.Forms
4+
@using Microsoft.AspNetCore.Components.Routing
5+
@using Microsoft.AspNetCore.Components.Web
6+
@using static Microsoft.AspNetCore.Components.Web.RenderMode
7+
@using Microsoft.AspNetCore.Components.Web.Virtualization
8+
@using Microsoft.JSInterop
9+
@using DisplayValidationMessage.Client
10+
@using Syncfusion.Blazor
11+
@using Syncfusion.Blazor.Data
12+
@using Syncfusion.Blazor.Grids
13+
@using Syncfusion.Blazor.Calendars
14+
@using Syncfusion.Blazor.DropDowns
15+
@using Syncfusion.Blazor.Inputs
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}

DisplayValidationMessage.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisplayValidationMessage", "DisplayValidationMessage\DisplayValidationMessage.csproj", "{DB7A0335-EBB4-4DAF-8873-FAF815655816}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisplayValidationMessage.Client", "DisplayValidationMessage.Client\DisplayValidationMessage.Client.csproj", "{745D75AD-91C0-4BB5-8904-A564B5BDEE1E}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{DB7A0335-EBB4-4DAF-8873-FAF815655816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{DB7A0335-EBB4-4DAF-8873-FAF815655816}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{DB7A0335-EBB4-4DAF-8873-FAF815655816}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{DB7A0335-EBB4-4DAF-8873-FAF815655816}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{745D75AD-91C0-4BB5-8904-A564B5BDEE1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{745D75AD-91C0-4BB5-8904-A564B5BDEE1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{745D75AD-91C0-4BB5-8904-A564B5BDEE1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{745D75AD-91C0-4BB5-8904-A564B5BDEE1E}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {9A47E96F-4230-4724-AB4E-4EAE5FDEB5EE}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
@* <link rel="stylesheet" href="bootstrap/bootstrap.min.css" /> *@
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/css/bootstrap.min.css">
10+
<link rel="stylesheet" href="app.css" />
11+
<link rel="stylesheet" href="DisplayValidationMessage.styles.css" />
12+
<link rel="icon" type="image/png" href="favicon.png" />
13+
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
14+
<HeadOutlet />
15+
</head>
16+
17+
<body>
18+
<Routes />
19+
<script src="_framework/blazor.web.js"></script>
20+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
21+
</body>
22+
23+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>
18+
19+
<div id="blazor-error-ui">
20+
An unhandled error has occurred.
21+
<a href="" class="reload">Reload</a>
22+
<a class="dismiss">🗙</a>
23+
</div>

Validation_GridDialogTemplate/Shared/MainLayout.razor.css renamed to DisplayValidationMessage/Components/Layout/MainLayout.razor.css

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,7 @@
44
flex-direction: column;
55
}
66

7-
.topnav {
8-
height: 3.5rem;
9-
background-color: rgba(0,0,0,0.4);
10-
}
11-
12-
.navbar-toggler {
13-
background-color: #05163C;
14-
}
15-
16-
.navbar-brand {
17-
font-size: 1.1rem;
18-
margin-right: 24px;
19-
}
20-
21-
@media (min-width: 641px) {
22-
.navbar-toggler {
23-
display: block;
24-
}
25-
26-
.collapse {
27-
/* Never collapse the sidebar for wide screens */
28-
display: block;
29-
}
30-
}
31-
32-
.main {
7+
main {
338
flex: 1;
349
}
3510

@@ -43,29 +18,30 @@
4318
justify-content: flex-end;
4419
height: 3.5rem;
4520
display: flex;
46-
align-items: left;
21+
align-items: center;
4722
}
4823

49-
.top-row ::deep a, .top-row .btn-link {
24+
.top-row ::deep a, .top-row ::deep .btn-link {
5025
white-space: nowrap;
5126
margin-left: 1.5rem;
27+
text-decoration: none;
28+
}
29+
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
5232
}
5333

54-
.top-row a:first-child {
34+
.top-row ::deep a:first-child {
5535
overflow: hidden;
5636
text-overflow: ellipsis;
5737
}
5838

5939
@media (max-width: 640.98px) {
60-
.top-row:not(.auth) {
61-
display: none;
62-
}
63-
64-
.top-row.auth {
40+
.top-row {
6541
justify-content: space-between;
6642
}
6743

68-
.top-row a, .top-row .btn-link {
44+
.top-row ::deep a, .top-row ::deep .btn-link {
6945
margin-left: 0;
7046
}
7147
}
@@ -88,8 +64,33 @@
8864
z-index: 1;
8965
}
9066

91-
.main > div {
92-
padding-left: 1rem !important;
67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
73+
.top-row, article {
74+
padding-left: 2rem !important;
9375
padding-right: 1.5rem !important;
9476
}
9577
}
78+
79+
#blazor-error-ui {
80+
background: lightyellow;
81+
bottom: 0;
82+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
83+
display: none;
84+
left: 0;
85+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
86+
position: fixed;
87+
width: 100%;
88+
z-index: 1000;
89+
}
90+
91+
#blazor-error-ui .dismiss {
92+
cursor: pointer;
93+
position: absolute;
94+
right: 0.75rem;
95+
top: 0.5rem;
96+
}

0 commit comments

Comments
 (0)