Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# BlazorWebFormsComponents
A collection of Blazor components that emulate the web forms components of the same name

[![Build status](https://dev.azure.com/FritzAndFriends/BlazorWebFormsComponents/_apis/build/status/BlazorWebFormsComponents-.NET%20Standard-CI)](https://dev.azure.com/FritzAndFriends/BlazorWebFormsComponents/_build/latest?definitionId=14)

## Controls proposed to be migrated
There are a significant number of controls in ASP.NET Web Forms, and we will focus on creating components in the following order:

Expand Down
18 changes: 12 additions & 6 deletions samples/BeforeWebForms/BeforeWebForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\src\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
Expand Down Expand Up @@ -99,18 +102,14 @@
<HintPath>..\..\src\packages\Microsoft.AspNet.FriendlyUrls.Core.1.0.2\lib\net45\Microsoft.AspNet.FriendlyUrls.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
<HintPath>..\..\src\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Content\bootstrap-theme.css" />
<Content Include="Content\bootstrap-theme.min.css" />
<Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" />
<Content Include="Content\Site.css" />
<Content Include="ControlSamples\ListView\Default.aspx" />
<Content Include="ControlSamples\ListView\ModelBinding.aspx" />
<Content Include="Default.aspx" />
<Content Include="favicon.ico" />
<Content Include="fonts\glyphicons-halflings-regular.svg" />
Expand Down Expand Up @@ -168,6 +167,13 @@
<Compile Include="ControlSamples\ListView\Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="ControlSamples\ListView\ModelBinding.aspx.cs">
<DependentUpon>ModelBinding.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ControlSamples\ListView\ModelBinding.aspx.designer.cs">
<DependentUpon>ModelBinding.aspx</DependentUpon>
</Compile>
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
Expand Down Expand Up @@ -250,8 +256,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\src\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
<Error Condition="!Exists('..\..\src\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
<Error Condition="!Exists('..\..\src\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\src\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
<Import Project="..\..\src\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\..\src\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
28 changes: 27 additions & 1 deletion samples/BeforeWebForms/ControlSamples/ListView/Default.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@

<h2>ListView control homepage</h2>

<div>
Other usage samples: <a href="ModelBinding.aspx">ModelBinding Sample</a>
</div>

<p>Here is a simple listview bound to a collection of widgets.</p>

<asp:ListView ID="simpleListView" runat="server" ItemType="SharedSampleObjects.Models.Widget">
<asp:ListView ID="simpleListView"
runat="server"
Enabled="true"
ItemType="SharedSampleObjects.Models.Widget">
<LayoutTemplate>
<table>
<thead>
Expand All @@ -22,6 +29,14 @@
</tbody>
</table>
</LayoutTemplate>
<AlternatingItemTemplate>
<tr class="table-dark">
<td><%# Item.Id %></td>
<td><%# Item.Name %></td>
<td><%# Item.Price.ToString("c") %></td>
<td><%# Item.LastUpdate.ToString("d") %></td>
</tr>
</AlternatingItemTemplate>
<ItemTemplate>
<tr>
<td><%# Item.Id %></td>
Expand All @@ -30,6 +45,17 @@
<td><%# Item.LastUpdate.ToString("d") %></td>
</tr>
</ItemTemplate>
<ItemSeparatorTemplate>
<tr>
<td colspan="4" style="border-bottom: 1px solid black;">&nbsp;</td>
</tr>
</ItemSeparatorTemplate>
<EmptyDataTemplate>
<tr>
<td colspan="4">No widgets available</td>
</tr>
</EmptyDataTemplate>
<EmptyItemTemplate></EmptyItemTemplate>
</asp:ListView>

<code>&lt;table&gt;<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ protected void Page_Load(object sender, EventArgs e)
simpleListView.DataBind();

}

}
}
58 changes: 58 additions & 0 deletions samples/BeforeWebForms/ControlSamples/ListView/ModelBinding.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModelBinding.aspx.cs" Inherits="BeforeWebForms.ControlSamples.ListView.ModelBinding" MasterPageFile="~/Site.Master" %>

<asp:Content runat="server" ContentPlaceHolderID="MainContent">

<h2>ListView ModelBinding Sample</h2>

<p>Here is a listview using ModelBinding to interact with widgets.</p>

<asp:ListView ID="simpleListView"
runat="server"
SelectMethod="simpleListView_GetData"
ItemType="SharedSampleObjects.Models.Widget">
<LayoutTemplate>
<table>
<thead>
<tr>
<td>Id</td>
<td>Name</td>
<td>Price</td>
<td>Last Update</td>
</tr>
</thead>
<tbody>
<tr runat="server" id="itemPlaceHolder"></tr>
</tbody>
</table>
</LayoutTemplate>
<AlternatingItemTemplate>
<tr class="table-dark">
<td><%# Item.Id %></td>
<td><%# Item.Name %></td>
<td><%# Item.Price.ToString("c") %></td>
<td><%# Item.LastUpdate.ToString("d") %></td>
</tr>
</AlternatingItemTemplate>
<ItemTemplate>
<tr>
<td><%# Item.Id %></td>
<td><%# Item.Name %></td>
<td><%# Item.Price.ToString("c") %></td>
<td><%# Item.LastUpdate.ToString("d") %></td>
</tr>
</ItemTemplate>
<ItemSeparatorTemplate>
<tr>
<td colspan="4" style="border-bottom: 1px solid black;">&nbsp;</td>
</tr>
</ItemSeparatorTemplate>
<EmptyDataTemplate>
<tr>
<td colspan="4">No widgets available</td>
</tr>
</EmptyDataTemplate>
<EmptyItemTemplate></EmptyItemTemplate>
</asp:ListView>


</asp:Content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using SharedSampleObjects.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BeforeWebForms.ControlSamples.ListView
{
public partial class ModelBinding : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

// The return type can be changed to IEnumerable, however to support
// paging and sorting, the following parameters must be added:
// int maximumRows
// int startRowIndex
// out int totalRowCount
// string sortByExpression
public IQueryable<Widget> simpleListView_GetData()
{
return Widget.SimpleWidgetList.AsQueryable();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions samples/BeforeWebForms/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<system.web>
<compilation debug="true" targetFramework="4.8">
<assemblies>
<add assembly="netstandard, Version=2.0.3.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51"/>
<add assembly="netstandard, Version=2.0.3.0, Culture=neutral, &#xD;&#xA; PublicKeyToken=cc7b13ffcd2ddd51" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.8" />
Expand Down
94 changes: 61 additions & 33 deletions src/AfterBlazorServerSide/Pages/ControlSamples/ListView/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,74 @@

<h2>ListView Component homepage</h2>

<div>
Other usage samples: <a href="./ControlSamples/ListView/ModelBinding">ModelBinding Sample</a>
</div>

<p>Here is a simple listview bound to a collection of widgets.</p>

<ListView ID="simpleListView"
runat="server"
ItemType="SharedSampleObjects.Models.Widget"
Items="Widget.SimpleWidgetList">
<LayoutTemplate>
<table>
<thead>
<tr>
<td>Id</td>
<td>Name</td>
<td>Price</td>
<td>Last Update</td>
</tr>
</thead>
<tbody>
<tr runat="server" id="itemPlaceHolder"></tr>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate Context="Item">
<tr>
<td>@Item.Id</td>
<td>@Item.Name</td>
<td>@Item.Price.ToString("c")</td>
<td>@Item.LastUpdate.ToString("d")</td>
</tr>
</ItemTemplate>
</ListView>
<table class="table">
<thead>
<tr>
<td>Id</td>
<td>Name</td>
<td>Price</td>
<td>Last Update</td>
</tr>
</thead>
<tbody>
<ListView @ref="simpleListView"
runat="server"
EnableViewState="false"
Context="Item"
ItemType="SharedSampleObjects.Models.Widget">
<AlternatingItemTemplate>
<tr class="table-dark">
<td>@Item.Id</td>
<td>@Item.Name</td>
<td>@Item.Price.ToString("c")</td>
<td>@Item.LastUpdate.ToString("d")</td>
</tr>
</AlternatingItemTemplate>
<ItemTemplate>
<tr>
<td>@Item.Id</td>
<td>@Item.Name</td>
<td>@Item.Price.ToString("c")</td>
<td>@Item.LastUpdate.ToString("d")</td>
</tr>
</ItemTemplate>
<ItemSeparatorTemplate>
@*<tr>
<td colspan="4" style="border-bottom: 1px solid black;">&nbsp;</td>
</tr>*@
</ItemSeparatorTemplate>
<EmptyDataTemplate>
<tr>
<td colspan="4">No widgets available</td>
</tr>
</EmptyDataTemplate>
</ListView>
</tbody>
</table>

@code {

override void OnInitialized()
{
BlazorWebFormsComponents.ListView<Widget> simpleListView { get; set; }

protected override void OnAfterRender(bool firstRender)
{

if (firstRender)
{
simpleListView.DataSource = Widget.SimpleWidgetList;
simpleListView.DataBind();
}


//base.OnParametersSet();
base.OnAfterRender(firstRender);

base.OnInitialized();
}
}

}

Loading