OnTextChanged Event for a label control

  • Thread starter Thread starter Sue
  • Start date Start date
S

Sue

Hello

Is there an equivalent of a OnTextChangedEvent for a asp: label
control in asp.Net 2.0. Every time the text of a label changes, I want
the items in a listbox control cleared.

TIA
Sue..
 
Since ASP.NET controls are rendered to the client as HTML (in this case, a
<SPAN> tag), you need to be thinking about what client-side event would work
for you, the server-side events are only triggered if a postback is
initiated. So, you should add this to your asp:label control via the
page_load() event handler:

lblSomething.attributes.add("onChange","clientSideFunction()")

And then add a client-side function that matches the second parameter you
gave above that does the clearing of the listbox data.
 
Back
Top