Answer the question
In order to leave comments, you need to log in
How to update GriView by timer?
There is a task to update ONLY GridView on the page or other element on the page in ASP.NET on the timer???
I saw a page refresh on a timer in JS, but I don’t get how to change it to an element
Answer the question
In order to leave comments, you need to log in
To change only 1 element, AJAX requests are required. Apparently you are using Web Forms - there are 2 controls for it - ScriptManager and UpdatePanel. Actually what lies inside the UpdatePanel is updated asynchronously. dare
Oh, horror, combine buttons into an array and get rid of code duplication
How to make buttons react to events, I won’t tell you exactly now, but I’ll tell you how to look:
Add a simple button to the form. Double click on it. A method for the event will be created in the code, where you will immediately be transferred. We are not interested in this, we are interested in what was created in the automatically generated code (there is a separate file in the form). There for your button there will be something like this.button1.onClick += button1_Click; this is exactly what you need.
In general, you can look at this auto-generated code as a cheat sheet in order to learn how to implement such things.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question