How to solve the problem of web page blinking when each control is used in this web page, So please any suggestions to prevent web page blinking other than using update panel.
How to solve the problem of web page blinking when each control is used in this web page, So please any suggestions to prevent web page blinking other than using update panel.
Other options are jQuery AJAX or fetch to create HTTP requests from JavaScript code running in the browser. This approach requires that you write code to update the DOM. You'll also need to create Web Methods to handler the request.
I recommend moving to MVC/Web API as Web Forms can be challenging once you move away from using standard server controls like the Update Panel.
Can you give me example of Web Methods to handler the request
This pattern is very mature a Google search will find many examples. The key is writing code to update the DOM which is generally unique to your application. You'll need to set aside some time to learn fundamental JavaScript/jQuery. Also the Web Method
in the example below is static which means the method is NOT able to see the instance members which includes server controls.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebFormsDemo
{
public partial class AjaxDemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string DoSomething(string inputParam)
{
return $"You sent {inputParam}.";
}
}
}
By web page blinking you mean postback. You can prevent it making using asynchronous request to your C# pages i.e.
.aspx.cs.
In web forms you can use jQuery to easily call [WebMethod] and making the use of asynchronous solutions. I recommend you to read article -
jQuery to call WebMethod asynchronously.
Helping you always. Don't forget to click "Mark as Answer" on the post that helped you.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
Member
1 Points
10 Posts
Prevent Web page blinking
Oct 02, 2019 11:44 AM|engzezo|LINK
Dear all
How to solve the problem of web page blinking when each control is used in this web page, So please any suggestions to prevent web page blinking other than using update panel.
Thanks in advance
Regards,
All-Star
43721 Points
18706 Posts
Re: Prevent Web page blinking
Oct 02, 2019 12:10 PM|mgebhard|LINK
Other options are jQuery AJAX or fetch to create HTTP requests from JavaScript code running in the browser. This approach requires that you write code to update the DOM. You'll also need to create Web Methods to handler the request.
I recommend moving to MVC/Web API as Web Forms can be challenging once you move away from using standard server controls like the Update Panel.
Member
1 Points
10 Posts
Re: Prevent Web page blinking
Oct 03, 2019 10:19 AM|engzezo|LINK
Dear mgebhard
Can you give me example of Web Methods to handler the request
Regards,
All-Star
43721 Points
18706 Posts
Re: Prevent Web page blinking
Oct 03, 2019 10:59 AM|mgebhard|LINK
This pattern is very mature a Google search will find many examples. The key is writing code to update the DOM which is generally unique to your application. You'll need to set aside some time to learn fundamental JavaScript/jQuery. Also the Web Method in the example below is static which means the method is NOT able to see the instance members which includes server controls.
Standard AJAX pattern with a simple DOM update.
Participant
1060 Points
732 Posts
Re: Prevent Web page blinking
Oct 03, 2019 12:23 PM|yogyogi|LINK
By web page blinking you mean postback. You can prevent it making using asynchronous request to your C# pages i.e. .aspx.cs.
In web forms you can use jQuery to easily call [WebMethod] and making the use of asynchronous solutions. I recommend you to read article - jQuery to call WebMethod asynchronously.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠