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 6628809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:10:14+00:00 2026-05-25T22:10:14+00:00

So this is working well for me so far but I do not want

  • 0

So this is working well for me so far but I do not want to make a new method for every image on the page. How do I get the control “Card” in the codebehind method when it is called so I can use the same method on every image button. Is there a better way to do this? All I want is to rotate an image 90 deg when clicked and, when clicked again rotate the image back. The problem is that I want to use only one method that will rotate any image.

protected void Card_Click(object sender, ImageClickEventArgs e)
    {
        if (Card.CssClass == "rotate90Large")
        {
            Card.CssClass = "";
        }
        else
        {
            Card.CssClass = "rotate90Large";
        }
    }

.aspx

<style type="text/css"> 
    .rotate90Large{-ms-transform: rotate(90deg); margin-left:45px; } 

</style>

<asp:ImageButton ID="Card" ImageUrl="Graphics/image.jpg" runat="server" onclick="Card_Click"  />
  • 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-05-25T22:10:14+00:00Added an answer on May 25, 2026 at 10:10 pm

    Casting the sender should be sufficient, and you can subscribe all image buttons to the same click event, in your case Card_Click

    protected void Card_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton img = (ImageButton)sender;
    
        if (img.CssClass == "rotate90Large")
        {
            img.CssClass = "";
        }
        else
        {
            img.CssClass = "rotate90Large";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to get this working but for some reason it's just not right.
I currently have this working but it requires me to have a static method
I'm working on a little wordpress plugin rate my whatever. This plugin works well
Strangely I had this working before but I reinstalled my system, upgraded to w7
I have this working great, but I'd like a deeper understanding of what is
I can't get this working for the life of me. Here is a snippet
I think I have this working but I need advice. I'd like to know
Well this might sound easy but to me it is confusing as heck. I
Had this working; at one stage. The problem is the following text is now
Has anyone got this working in a web application? No matter what I do

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.