tag with display: none - asp net

0

I have some tags <h3> , <p> with display: none or empty (usually use them to display messages or some div), when clicking on any system event, these tags appear: display: block or else they are filled by innerHTML . When I click on another event, these tags return to what they were at the beginning: display: none or empty.

Can you make sure they do not return to their initial state? That is, when I click on the event that they appear, they stay that way until I want to disable them again. Because in the second event to click, it may be the case that these tags should be activated, understood? So I would not need to call a method that activates them again. When I need to disable them, just pass display: none (as it was at the beginning). Did you understand?

So what happens is that every time I trigger an event a postback occurs, right? And these tags (div, h3) return to their initial values. It's not something I told you to do, I did not want them back to their initial values.

    
asked by anonymous 05.01.2017 / 08:13

1 answer

2

There are two golden rules in the programming world:

  • Computer does not think: it does not analyze and make any decision other than what it was instructed to do;
  • Computer does not fail: it does exactly what it was instructed to do, exactly;
  • This applies to your scenario, if an object is having its state changed, it is because something exists that is changing it. Fact.

    One should then find out what action is doing this, and condition it to do no more.

    Trying to keep the state from changing, without identifying who is doing it and why, is like a car with a flat fuel tank, but instead of fixing the hole, you are simply attaching another tank on it so the fuel does not end so quickly.

    Find out why your object is having its restored state, so it will definitely solve the problem, and with the lowest processing cost possible.

        
    05.01.2017 / 09:46