Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved Customer object to Shared project
- Loading branch information
1 parent
dd15ae4
commit 8f5716f
Showing
4 changed files
with
91 additions
and
128 deletions.
There are no files selected for viewing
61 changes: 12 additions & 49 deletions
61
samples/AfterBlazorServerSide/Pages/ControlSamples/GridView/AutoGeneratedColumns.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,12 @@ | ||
@page "/ControlSamples/GridView/AutoGeneratedColumns" | ||
|
||
<h2>GridView Default AutoGeneratedColumns</h2> | ||
|
||
<Nav /> | ||
|
||
<GridView ItemType="Customer" | ||
DataKeyNames="CustomerID" | ||
SelectMethod="GetCustomers" | ||
AutogenerateColumns="true"> | ||
</GridView> | ||
|
||
@code{ | ||
public IQueryable<Customer> GetCustomers(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount) | ||
{ | ||
var customers = new List<Customer>(); | ||
var c1 = new Customer | ||
{ | ||
CustomerID = 1, | ||
FirstName = "John", | ||
LastName = "Smith", | ||
CompanyName = "Virus" | ||
}; | ||
|
||
var c2 = new Customer | ||
{ | ||
CustomerID = 2, | ||
FirstName = "Jose", | ||
LastName = "Rodriguez", | ||
CompanyName = "Boring" | ||
}; | ||
|
||
|
||
var c3 = new Customer | ||
{ | ||
CustomerID = 3, | ||
FirstName = "Jason", | ||
LastName = "Ramirez", | ||
CompanyName = "Fun Machines" | ||
}; | ||
|
||
customers.Add(c1); | ||
customers.Add(c2); | ||
customers.Add(c3); | ||
|
||
totalRowCount = customers.Count(); | ||
return customers.AsQueryable(); | ||
} | ||
} | ||
@page "/ControlSamples/GridView/AutoGeneratedColumns" | ||
|
||
<h2>GridView Default AutoGeneratedColumns</h2> | ||
|
||
<Nav /> | ||
|
||
<GridView ItemType="Customer" | ||
DataKeyNames="CustomerID" | ||
SelectMethod="Customer.GetCustomers" | ||
AutogenerateColumns="true"> | ||
</GridView> | ||
|
18 changes: 0 additions & 18 deletions
18
samples/AfterBlazorServerSide/Pages/ControlSamples/GridView/Customer.cs
This file was deleted.
Oops, something went wrong.
85 changes: 24 additions & 61 deletions
85
samples/AfterBlazorServerSide/Pages/ControlSamples/GridView/Default.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,24 @@ | ||
@page "/ControlSamples/GridView" | ||
|
||
<h2>GridView Default Example</h2> | ||
|
||
<Nav /> | ||
|
||
<GridView ItemType="Customer" | ||
AutogenerateColumns="false" | ||
DataKeyNames="CustomerID" | ||
SelectMethod="GetCustomers" | ||
EmptyDataText="No data available"> | ||
<Columns> | ||
<BoundField DataField="CustomerID" HeaderText="ID" /> | ||
<BoundField DataField="CompanyName" HeaderText="CompanyName" /> | ||
<BoundField DataField="FirstName" HeaderText="FirstName"/> | ||
<BoundField DataField="LastName" HeaderText="LastName"/> | ||
<TemplateField> | ||
<ItemTemplate Context="Item"> | ||
<button type="button">Click Me! @Item.FirstName</button> | ||
</ItemTemplate> | ||
</TemplateField> | ||
</Columns> | ||
</GridView> | ||
|
||
@code{ | ||
public IQueryable<Customer> GetCustomers(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount) | ||
{ | ||
var customers = new List<Customer>(); | ||
var c1 = new Customer | ||
{ | ||
CustomerID = 1, | ||
FirstName = "John", | ||
LastName = "Smith", | ||
CompanyName = "Virus" | ||
}; | ||
|
||
var c2 = new Customer | ||
{ | ||
CustomerID = 2, | ||
FirstName = "Jose", | ||
LastName = "Rodriguez", | ||
CompanyName = "Boring" | ||
}; | ||
|
||
|
||
var c3 = new Customer | ||
{ | ||
CustomerID = 3, | ||
FirstName = "Jason", | ||
LastName = "Ramirez", | ||
CompanyName = "Fun Machines" | ||
}; | ||
|
||
customers.Add(c1); | ||
customers.Add(c2); | ||
customers.Add(c3); | ||
|
||
totalRowCount = customers.Count(); | ||
return customers.AsQueryable(); | ||
} | ||
} | ||
@page "/ControlSamples/GridView" | ||
|
||
<h2>GridView Default Example</h2> | ||
|
||
<Nav /> | ||
|
||
<GridView ItemType="Customer" | ||
AutogenerateColumns="false" | ||
DataKeyNames="CustomerID" | ||
SelectMethod="Customer.GetCustomers" | ||
EmptyDataText="No data available"> | ||
<Columns> | ||
<BoundField DataField="CustomerID" HeaderText="ID" /> | ||
<BoundField DataField="CompanyName" HeaderText="CompanyName" /> | ||
<BoundField DataField="FirstName" HeaderText="FirstName"/> | ||
<BoundField DataField="LastName" HeaderText="LastName"/> | ||
<TemplateField> | ||
<ItemTemplate Context="Item"> | ||
<button type="button">Click Me! @Item.FirstName</button> | ||
</ItemTemplate> | ||
</TemplateField> | ||
</Columns> | ||
</GridView> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace SharedSampleObjects.Models | ||
{ | ||
public class Customer | ||
{ | ||
public int CustomerID { get; set; } | ||
|
||
public string FirstName { get; set; } | ||
|
||
public string LastName { get; set; } | ||
|
||
public string CompanyName { get; set; } | ||
|
||
public static IQueryable<Customer> GetCustomers(int maxRows, int startRowIndex, string sortByExpression, out int totalRowCount) | ||
{ | ||
var customers = new List<Customer>(); | ||
var c1 = new Customer | ||
{ | ||
CustomerID = 1, | ||
FirstName = "John", | ||
LastName = "Smith", | ||
CompanyName = "Virus" | ||
}; | ||
|
||
var c2 = new Customer | ||
{ | ||
CustomerID = 2, | ||
FirstName = "Jose", | ||
LastName = "Rodriguez", | ||
CompanyName = "Boring" | ||
}; | ||
|
||
|
||
var c3 = new Customer | ||
{ | ||
CustomerID = 3, | ||
FirstName = "Jason", | ||
LastName = "Ramirez", | ||
CompanyName = "Fun Machines" | ||
}; | ||
|
||
customers.Add(c1); | ||
customers.Add(c2); | ||
customers.Add(c3); | ||
|
||
totalRowCount = customers.Count(); | ||
return customers.AsQueryable(); | ||
} | ||
|
||
} | ||
} |