Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8567261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:50:30+00:00 2026-06-11T17:50:30+00:00

How to add CssClass to clicked element? Protected Sub ShowButton_Click(ByVal sender As Object, ByVal

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:50:31+00:00Added an answer on June 11, 2026 at 5:50 pm

    The sender parameter 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 ShowButton is a Button control. If not, change Button to whatever the type of the control is:

    Protected Sub ShowButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShowButton.Click
    
        CType(sender, Button).CssClass = "active" 
    
    End Sub
    

    If your control only has the one class, you can easily remove it by doing the following:

    CType(sender, Button).CssClass = "" 
    

    However, if you have multiple classes it can get more complicated. You could do:

    CType(sender, Button).CssClass = CType(sender, Button).CssClass.Replace("active", "")
    

    This only replaces active in the CssClass string property with a blank string. This works fine unless you have a class like reactive as well. This would then be changed to re.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This protected void Page_Load(object sender, EventArgs e) { RadioButtonList1.Items.Add(new ListItem(London,1)); RadioButtonList1.Items.Add(new ListItem(Paris, 2)); }
How do I add a css class to an Div element in JQuery? I
I am creating Table dynamically: Table table = new Table(); table.CssClass=tableclass; ... pnlPanel.Controls.Add(table); As
I'm trying to add a class to elements clicked on. The elements have several
In My Project, I want to add CssClass to All asp:Buttons which don't have
How to add new css class or id and then write properties for html
I need to add a CSS class to the TR (or multiple TR's) of
I would like to add a css class to a child view from a
Is it possible to add a CSS class to the inner pages within a
I add my url xxx/getjson.php to a webhook and once a person signup, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.