Assigning CSS values to UpdateProgress using JavaScript

I've been trying to assign values to the ASP.NET UpdateProgress control using the code below, but it doesn't seem to be working:

   <script type="text/javascript">
  var updateProgress=document.getElementById ('<%=UpdateProgressLinkActivity.ClientID%>');
   updateProgress.style.position='absolute';
   updateProgress.style.width='250px';
   updateProgress.style.height='100px';
   updateProgress.style.top='0px';
   updateProgress.style.left='0px';
  </script>

The control name is just copied and pasted.

Answer №1

To implement this functionality, insert the following code within a function and trigger it on an event (such as onload).

<script type="text/javascript>
function ShowProgressBar()
{
   var progressBar = document.getElementById('<%=UpdateProgressLinkActivity.ClientID%>');
   progressBar.style.position = 'absolute';
   progressBar.style.width = '250px';
   progressBar.style.height = '100px';
   progressBar.style.top = '0px';
   progressBar.style.left = '0px';
} 
 </script>

Integrate the following code snippet into your Aspx file:

<asp:Button OnClientClick="ShowProgressBar()" ..../>

Answer №2

Here is a suggestion for you to try:

var updateProgress = document.getElementById('<%=UpdateProgressLinkActivity.ID%>');

You can also consider using the following code:

<asp:UpdateProgress value="make sure to get client id" ID="UpdateProgressLinkActivity" runat="server" AssociatedUpdatePanelID="UpdatePanelLinkActivity" DynamicLayout="True"> <ProgressTemplate> <div style="position:absolute; top:50%; left:50%; background-color:white;" id="divLoading"> <img src="Images/loading25.gif" alt="Loading..." style="" /> </div> </ProgressTemplate> </asp:UpdateProgress>

Remember to specify the value as "make sure to get client id."

Additionally, you can use jQuery like this: var updateProgress = $("#UpdateProgressLinkActivity").val();

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to set up authentication using next-iron-session within getServerSideProps without having to duplicate the code on every page?

Currently, I have successfully implemented authentication in my NextJS app using next-iron-session with the getServerSideProps method. However, I find myself having to duplicate this code on every page where user authentication is required. I am looking ...

Implementing FAQs on ASP.NET MVC is my latest project

I have stored all the questions and answers in a SQL Server table, and it is fetching them perfectly. The FAQ user interface displays all the questions correctly from the table. You can see the interface in action by clicking on the following links: Questi ...

Adjust the top position of a div element at regular intervals

How can I make the top position of an absolutely positioned div with children change every x seconds using jQuery? I tried using setInterval but it only changes once. Here is my code: .com_prices { width: 100%; height: 100%; overflow: hidden; back ...

The getJSON function encountered an error due to an unexpected token ":"

I have reviewed many similar questions and answers, but I am still struggling to solve my specific issue. Here is the code snippet in question: $.getJSON("http://maps.googleapis.com/maps/api/geocode/json?latlng=" + results[0].geometry.location.lat() + ", ...

Sleek menu emerges

I am seeking to create a dynamic menu that slides in from right to left displaying a h2 header and when it's done, reveals information sliding down from top to bottom. If a different option is clicked while the menu already exists, it should slide up ...

Creating an animated transition for an element's height with CSS

I need to animate the height of a div that doesn't have a specified height. Using max-height isn't an option due to multiple potential height amounts. I attempted adding transition: height 0.2s ease to the div, but it didn't work as expecte ...

What is the clarification on AngularJs' ng-options?

In my demo, I have a small setup. Essentially, it consists of a select element with the following data: address: { select: { code: "0", name: "Select proof of address" }, letter: { ...

StateServer with .NET - Reliability at its finest

Our use of a StateServer for managing Session provides several advantages, such as support for web farm environments and IIS recycling. However, ensuring fault tolerance in this setup has become a priority. While the data stored in the Session is non-crit ...

Error: Attempting to destructure the 'recipes' property from 'props' results in a TypeError due to its undefined value

I am new to working with reactjs and encountered an error when trying to run a program. The specific error message is as follows: Uncaught TypeError: Cannot destructure property 'recipes' of 'props' as it is undefined. at RecipeList ...

Issue with dynamically adjusting flex box width using JavaScript

Currently, I am developing a user interface that heavily relies on flexbox. The layout consists of a content area and a sidebar that can be toggled by adding or removing a specific class. Whenever the sidebar is toggled, the content area needs to be manua ...

Navigating through different pages in Angular2 using Asp.net 4.5

I am in need of assistance. I recently switched back to using ASP.NET 4.5 from developing with Angular2 and ASP.NET Core, and I am facing a major issue with routing. When I was using ASP.NET Core, redirecting all 404 requests to index.html was simple with ...

Make sure all of the inner tags are properly contained within their respective containers

In my explanatory bubble, I aim to include text within the explain-header div as a container for my explanations: /*Explain Bubble*/ .explain-container { position: relative; overflow: hidden; max-width: 70vw; max-height: 50vh; background-c ...

The data sent from the model to the controller using ajax appears to be empty

I am facing an issue where I am trying to send only 2 ID's to the controller via Ajax, but the model ends up being null every time. My view model is quite straightforward: public class CityAreaBindingModel { public int CityID { get; set; } p ...

The image sequence animation only loads once and does not continue indefinitely

Here is my code snippet: I have a sequence of 15 images that should load one after the other in a loop with a specific time interval. However, I am facing a bug where the images keep playing infinitely when the page loads, but I want them to play only once ...

A guide on consolidating all app.use statements into a single shared file

My application's starting point, the index file, contains multiple instances of app.use. For example: app.use( if (!req.contextToken && req.contextTokenchecked) { req.queryToFirebase = false; req.contextTokenchecked = tru ...

Tick the box to activate the ability to uncheck multiple boxes when there are already a certain number of boxes checked

I am currently developing a multiple-choice form in my MVC5 app and I am struggling to find a way to disable unchecked boxes once a specific number of boxes have been checked. For example, if 3 out of 5 boxes are checked, the remaining 2 should be disabled ...

Methods for altering the color of a div using addEventListener

Why doesn't the color change when I click on the div with the class "round"? Also, how can I implement a color change onclick? var round = document.querySelector(".round"); round.addEventListener("click", function() { round.style.backgroundCol ...

What are some ways I can personalize my react-table components?

I want to customize the functionalities with unique layouts and positioning. Instead of using the default next and previous buttons, I prefer creating my own. Is there a way to achieve this without directly modifying the code in node_modules directory? ...

What is the best way to automatically collapse an open navbar in Bootstrap 3 when it is clicked outside of the navbar element?

Is there a way to automatically close a collapsed navbar when clicking outside of the navbar itself? Currently, the only option is to toggle it open or closed using the navbar-toggle button. To see an example and code, click here. I have attempted the fo ...

The parameters sent through the axios.get request are not being properly defined on the express backend

I've been working on implementing a search feature, but I encountered an issue when trying to send data (specifically params) to the backend using an axios.get request - it kept showing up as undefined. In my React app's request handling functio ...