Label won't display when modified in code behind

G

Guest

I have a label control on my form I'm using the same way a label is used with
a validator control; the reason for this is lost somewhere in antiquity at my
employer. Anyway, I do a substantial amount of client-side data validation
via JavaScript, setting the Text property of the label to something pertinent
to the error encountered. Since the label is never invisible or hidden, the
message is shown as soon as the display refreshes. So far, so good.

Let's now say that everything passes the client-side validation and
execution is passed to the form's code-behind, but an error occurs when I try
persisting the data out to the database. Again, I set the Text property of
the label to something pertaining to the error that occurred. In this
situation, the message is never displayed even though the Label control is
still visible and still contains text. Why is that?

Changing lblError's text property via JavaScript:
document.getElementById('ctl00_ContentPlaceHolder1_lblError').innerText
= 'Please enter at least one search criteria.';

Changing lblError's text property via VB.Net code-behind:
lblError.Text = "Unable to save highlighted record(s) to database."
 
G

Guest

Never mind. I wrapped the label in an asp:UpdatePanel and it works quite well.

Allen
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top