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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:47:05+00:00 2026-06-17T22:47:05+00:00

I’m trying to generate a grid of 1×1 pixels Images in .NET using VB.NET,

  • 0

I’m trying to generate a grid of 1×1 pixels Images in .NET using VB.NET, using this code:

    For i = 1 To 500
        Dim img As New ImageButton
        img.ID = "ibtn" + i.ToString
        img.ImageUrl = "images/design/click.gif"
        form1.FindControl("upperpanel").Controls.Add(img)
    Next

Problem is that it takes a very long time to generate the HTML when I’m running this on page_load event. Can anyone help me out to speed up the rendering of the controls.
Also
, I want to add Click event on each image button. How can I do that ??

Thanks

  • 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-17T22:47:07+00:00Added an answer on June 17, 2026 at 10:47 pm

    Ok, first thing to do is get the panel control once. Second, create your click method, and then add your handler. This needs to be done prior to the page load event. Use the page_Init event for creating your buttons when you need to add a handler.

        Private Sub WebForm1_Init(sender As Object, e As EventArgs) Handles Me.Init
        Dim tempPanel As Panel = form1.FindControl("upperpanel")
    
        If tempPanel Is Nothing Then
            Return
        End If
    
        For i = 1 To 500
            Dim img As New ImageButton
            img.ID = "ibtn" + i.ToString
            img.ImageUrl = "images/design/click.gif"
            AddHandler img.Click, AddressOf ImageButton_Click
            tempPanel.Controls.Add(img)
        Next
    End Sub
    
    Protected Sub ImageButton_Click(sender As Object, e As ImageClickEventArgs)
        Dim tempImageButton As ImageButton = CType(sender, ImageButton)
    
        Select Case tempImageButton.ID
            Case "ibtn1"
                        'blah
            Case Else
        End Select
    
    End Sub
    

    As far as performance goes, getting the panel control up front will improve performance. Probably not much. Creating 500 buttons is going to take some time.

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

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using JSon response to parse title,date content and thumbnail images and place
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am using jsonparser to parse data and images obtained from json response. When
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is

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.