Small code but it’s useful in many situations.
Hope, you may find it useful.
btnSave.Attributes.Add("onclick", "document.all." & txtOperationMessages.ClientID & ".innerText = '';"
– btnSave is the name of Button that the user suppose to click for clearing old message.
– txtOperationMessages is the name of control that shows message.