How to show a progress bar when loading some controls?

My controls are dynamically generated when the dropdown is changed by the user. These values ​​are loaded from the database. How to display progress bar during control generation?

+4
source share
4 answers

You can add a upload image to the form. When the user changes the item in the drop-down list, raise the onchange event with javascript. An example of adding a handler:

protected void Page_Load(object sender, EventArgs e) { dropdownlist1.Attributes.Add("onchange", "document.getElementById(\"loading_image\").style.visibility = \"visible\";"); } 

Before that, you must add an image to the form:

 <img style="visibility:hidden;" src="imageurl" runat="server" id="loading_image" /> 
+1
source

if (combobox.text == "type selected value") {download the progress bar here ..}

+1
source

After selecting the user, insert the <img> with the animated progress bar .gif. When the controls return to load on the page, use javascript to remove the <img> and paste the controls.

0
source

To display the actual progress you need to create a Context-Sensitive indicator. Here's an article showing how to show actual progress through ajax server-side operations.

0
source

Source: https://habr.com/ru/post/1448073/


All Articles