How to add CssClass to clicked element?
Protected Sub ShowButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShowButton.Click
// Add "active" CssClass to ShowButton
End Sub
Is it possible to reference to element by this ?
The
senderparameter is referring to the control which triggered this method (ie: the sender of the event).Therefore you can change the properties of this object.
Assming
ShowButtonis aButtoncontrol. If not, changeButtonto whatever the type of the control is:If your control only has the one class, you can easily remove it by doing the following:
However, if you have multiple classes it can get more complicated. You could do:
This only replaces
activein theCssClassstring property with a blank string. This works fine unless you have a class likereactiveas well. This would then be changed tore.