WorkplaceX.org

Boost your Business App

Hello World Counter

Following example shows how to add a button and count on every click.

AppMain is basically a json object. The variables Html and Button are references which are stored accordingly at the end of every request.

// File: Application/App/AppMain.cs

namespace Application
{
    using Framework.Json;
    using System.Threading.Tasks;

    public class AppMain : AppJson
    {
        public AppMain()
        {
            Html = new Html(this) { TextHtml = "Hello World" };
            Button = new Button(this) { TextHtml = "Click" };
        }

        public Html Html;

        public Button Button;

        public int Count;

        protected override Task ProcessAsync()
        {
            if (Button.IsClick)
            {
                Count += 1;
                Html.TextHtml = Count.ToString();
            }
            return base.ProcessAsync();
        }
    }
}

Counts on every click:

/assets/counter.png

Feedback

Provide feedback to this page if you have any question regarding content or something should get updated.


ABOUT

WorkplaceX is an initiative to simplify and standardize the development of business applications. It is based on ASP.NET Core, Angular, Bootstrap, Bulma and SQL Server.

Copyright © 2022 All Rights Reserved by WorkplaceX.org
v1.11 (Framework v3.52.22 ♥ 08:46:34)