color Lost between postbacks....

  • Thread starter Thread starter Nelson
  • Start date Start date
N

Nelson

My development environment is ASP.Net with VB.Net and .Net Framework 1.1.



For a web control text box through client code(java script) I am changing
the font color.

After post the color is not retaining.

Do I have to change some properties to retain the color between postbacks ?

TextBox.EnableViewState is set to TRUE.

Please advice.

Thanks,

Nelson
 
Hi Nelson,

If you change properties of a server-side control using client-side script,
the server-side logic doesn't know what you've done. Therefore, doesn't add
it to the viewstate and the changes are not retained.

In this case, you need to persist the value yourself and apply it whenever
the page is refreshed.
 
Hi Nelson,

Yes, the value can be retained across postbacks if you do something to
preserve it on the server-side.

Otherwise, ASP.NET can't help you because it doesn't know what you've
changed with the client script.

One technique would be to have a hidden server-side field and store the
colour. Of course, on page load you have to look up the colour and apply it
again to the textbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top