Loading...

DotNetEvents


DotNetEvents Example
@inherits ControlComponent

<asp.Button @ref="this.button" OnClick="this.SubmitBtn_Click">Submit</asp.Button>

@code {
                                            private Button button;

                                            protected override void OnInitialized()
    {
                                            this.ClientScript.RegisterStartupScript(this.GetType(), "beginPostBack"
            , "DotNetEvents.addEventListener('beginPostBack', function () { alert('beginPostBack'); });");
                                            this.ClientScript.RegisterStartupScript(this.GetType(), "endPostBack"
            , "DotNetEvents.addEventListener('endPostBack', function () { alert('endPostBack'); });");
    }

                                            protected void SubmitBtn_Click(object sender, EventArgs e)
    {
                                            this.InvokeWaitTask(async () =>
        {
                                            await Task.Delay(3000);
            button.Text = DateTime.Now.ToString();
        });
    }
}
Copyright © 2024 Jurio li All rights reserved.
An unhandled error has occurred. Reload 🗙