MVVM is a pattern that is used while dealing with views in WPF technology. and we call "WPF MVVM" for it.
In ASP.NET Web Form, we are disturbed about data-processing that is depending on view.
For independence of data-processing and view,we use data-binding pattern on ASP.NET Web Form.
Values of views are binding to specified parameters .Values are assigned automatically according to their parameters during processing data in a program.
<html>
<head runat="server">
<title>MVVM By ID</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:Hello ID="ViewModel" runat="server" />
請輸入您的大名:<asp:TextBox ID="TextBox1" runat="server" Text="<%$ Binding: Name %>"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="確定" OnClick="<%$ Binding: Button1_Click %>" /><br /><br />
<asp:Label ID="Label1" runat="server" Text="<%$ Binding: Text %>"></asp:Label>
</div>
</form>
</body>
</html>
public partial class ViewModel_Hello3 : ViewModel.Base.Default3
{
protected void Page_Load(object sender, EventArgs e)
{
}
public override void Button1_Click(object sender, EventArgs e)
{
if (Name != "")
{
Text = Name + ",您好。";
}
else
{
Text = "請輸入名字";
}
base.Button1_Click(sender, e);
}
}
<html>
<head runat="server">
<title>Bind Control & Method</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:UserControl ID="UserControl1" runat="server" />
<asp:Label ID="Label1" runat="server" Text='<%$ Binding : ID = UserControl1, GetText %>'></asp:Label>
<asp:Panel ID="Panel1" runat="server" ToolTip="456">
<asp:Label ID="Label2" runat="server" Text='<%$ Binding : Type = Panel, ToolTip %>'></asp:Label>
</asp:Panel>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" Text="789"></asp:TextBox>
<asp:Label ID="Label3" runat="server" Text='<%$ Binding : ID = TextBox1, Mode = OneWay , Text %>'></asp:Label>
<%-- Mode => Default, OneWay, TwoWay --%>
</div>
</form>
</body>
</html>
1.MVVM Pattern By Control ID
2.MVVM Pattern By Interface IView, IViewModel
3.MVVM With ViewModel Code Maker, Auto make ViewModel base class when build.
4.Bind Expression To Assign Control Property & Method
5.Behavior control's mimicry.
6.DataBoundControlHelper & ValueConverter
7.ExtensionsControl(1) : FreeDataSource, Pagination
8.ExtensionsControl(2) : PluralHolder, ContainerButton
9.ExtensionsControl(3) : RouteManager, HolderSource
codeplex: http://aspnetmvvmexcalibur.codeplex.com/
nuget: https://www.nuget.org/packages/ASP.NET_MVVM_Excalibur/