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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:38:38+00:00 2026-06-02T02:38:38+00:00

I need to bind client side onLoad event with ASP.Net Image control. I have

  • 0

I need to bind client side onLoad event with ASP.Net Image control. I have tried it for quite some time with no success.

Function Name onload="onLoadFunction(this)"

Script:

function onLoadFunction(img) {
     $(img).css("visibility", "visible"); // Using jQuery
     // img.style.visibility = "visible"; // Using just javascript.
 }

Markup:

<asp:Image ID="imgTopFourImg2" runat="server" width="170px" height="112px" CssClass="ArticleImgHP" border="0" ImageUrl="hello.jpg" OnLoad="onLoadFunction(this)" />

It is not working for me i would appreciate if someone can help me with 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-02T02:38:39+00:00Added an answer on June 2, 2026 at 2:38 am

    The OnLoad attribute is used to add an event handler the Load event, which is a server side event, not client side.

    If you want create the onload attribute of the generated image element, you need to use Attributes collection

    imgTopFourImg2.Attributes["onload"] = "onLoadFunction(this)";
    

    EDIT from comments

    Since the image is inside a repeater item this is not available in code behind. Handle ItemDataBound event:

    void R1_ItemDataBound(Object Sender, RepeaterItemEventArgs e) {
    
              // This event is raised for the header, the footer, separators, and items.
    
              // Execute the following logic for Items and Alternating Items.
              if (e.Item.ItemType == ListItemType.Item 
                      || e.Item.ItemType == ListItemType.AlternatingItem) 
                 {
    
                    var imgTopFourImg2 = e.Item.FindControl("imgTopFourImg2") as Image;
                    if (imgTopFourImg2 != null)
                        imgTopFourImg2.Attributes["onload"] = "onLoadFunction(this)";
                 }
              }
           }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation where I need to bind a click event to an
Regarding ASP.NET's GridView server control: Can I bind to a datasource in the code-behind,
Possible Duplicate: What client-side situations need bind()? I saw the server program binding to
I need my client to bind to a particular port and then connect to
I need to bind a property of a UserControl directly to another control, rather
I need to bind to a Storyboard, but I cant figure how. I have
I have a set of 'dynamic data' that I need to bind to the
I have a dropdown. I need to bind with two field of datatable value
I have a telerik grid in an asp.net mvc3 (RAZOR) View. While designing I
I'm trying to have my ASP.NET app listen for multicast UDP broadcasts. Unfortunately, I

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.