Greetings. It turns out that I have a Textbox
that when it loses the focus it changes its background color, all this thanks to a function that I have over there in JavaScript
. Later I have another Textbox
that makes a PostBack
that I need for a query to a database, and here is the problem:
when that second TextBox
makes PostBack
, the background color of the first one loses its property that it had acquired thanks to the JavaScript
function. And it makes sense, I know.
But is there any way to make the PostBack not affect the characteristics of the controls that are acquired from the client side? Or maybe doing something in Page_Load
? And if the answer is in this last, I do not know exactly what.
To make me understand a little better, I tried this in a script
:
document.getElementById('<%=Label1.ClientID%>').innerHTML= "Nuevo_texto";
The above changes the text of a Label
, is not it?
So far, normal, but if I then do a PostBack
, the Label
takes its default value.
How do I avoid this? Is it possible?