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

  • Home
  • SEARCH
  • 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 6941293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:52:00+00:00 2026-05-27T12:52:00+00:00

I know such questions are asked already on SO, and i also went through

  • 0

I know such questions are asked already on SO, and i also went through most of them but no one satisfied me, so i am posting mine one. Attached is my code. actually i am building a jquery gallery from code from databale. see the code:

  protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DisplayHotProducts();
            }
        }



        private void DisplayHotProducts()
        {
            var dt = ProductData.GetAllHotProducsts();
            if (dt != null && dt.Rows.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine(" <div id='spotlight_products' class='widget_box center_box'>");
                sb.AppendLine("<div class='wintitle'>");
                sb.AppendLine(" <div class='inner_wintitle'>");
                sb.AppendLine("  Hot Products</div></div>");
                sb.AppendLine("<div class='winbody'>");
                sb.AppendLine("<div class='mall_focus' id='mall_focus'>");
                sb.AppendLine("<a id='bp_carousel_prev'>prev</a>");
                sb.AppendLine("<a id='bp_carousel_next'>next</a>");
                sb.AppendLine("<div id='bp_carousel'>");
                sb.AppendLine(" <div class='carousel_list'>");


                for (int i = 0; i < dt.Rows.Count; i=i+5)
                {

                    sb.AppendLine(" <div class='product_list'>");
                    sb.AppendLine("<div class='bestproduct_wrapper'> <div class='bestproduct'>");
                    sb.AppendLine("   <div class='icon_best'></div>");
                    sb.AppendLine("<ul>");
                    sb.AppendLine(" <li class='best_Img'><span></span><a href='#' target='_blank'> ");
                    sb.AppendLine(string.Format(" <img src='{0}'  width='200' height='200'  /></a></li>", dt.Rows[i]["ImagePath"]));
                    sb.AppendLine("</ul>");
                    sb.AppendLine(" <p class='product_name'>");
                    sb.AppendLine(string.Format("<a href='Products/{0}'   target='_blank'>{1}</a></p>", dt.Rows[i]["Id"], dt.Rows[i]["Name"]));
                    sb.AppendLine("</div></div>");

                    for (int j = i+1; j <= 4; j++)
                    {
                        sb.AppendLine("<div class='product_item'>");
                        sb.AppendLine("<ul><li class='product_Img'>");
                        sb.AppendLine(string.Format("<a href='Products/{0}'><img src='{1}'  width='70' height='70'/></a>", dt.Rows[j]["Id"], dt.Rows[j]["ImagePath"]));
                        sb.AppendLine("</li></ul>");
                        sb.AppendLine(string.Format("<p class='product_name'><a href='Products/{0}'>{1}</a></p>", dt.Rows[j]["Id"], dt.Rows[j]["Name"]));
                        sb.AppendLine("</div>");
                    }
                }

                sb.AppendLine(@" </div></div></div></div></div>");
                ltlHotProducts.Text = sb.ToString();
            }
        }
    }

My code behind has the above code only and the page load is firing twice.

Also this is code behind of a usercontrol, placed on a page where i have 3 more similar control performing similar functionalities that is , building jquery slideshows from code behind. But the above two user controls has some issues with the img tags as some of them are missing images. Also the page on which the user controls are placed has a master page. Now please suggest me the solution.

So the heirarchy is something like this:

Master Page (master) -> Content Page (aspx) -> Has->3 UserControls (ascx)

  • 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-27T12:52:01+00:00Added an answer on May 27, 2026 at 12:52 pm

    I have typically seen two reasons for the PageLoad to fire twice – First, if you have an img tag that doesn’t have a src attribute, IE and Chrome will both request the page again, which causes the event to fire again. Second, if the event is wired up more than once, it’ll fire more than once; Typically I’ve seen this happen when the code behind includes the event wireup code (eg, this.PageLoad += ... PageLoad) and the page directive AutoEventWireup=True is included in the aspx file.

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

Sidebar

Related Questions

I know a few questions have been asked like this one before, such as
I know that such general questions shouldn't be asked, but can someone help me
I know that such type of questions exist in SF but they are very
I know questions like this have been asked numerous times, but not quite this
I know similar questions have been asked before, but still things are not clear
I know questions around javascript compression have been asked multiple times but I cannot
I know there is such a question on SO, but I could not find
I know there is no such thing as a dumb question but this is:
i know that .NET String class uses such behaviour, but I can't find any
I know its a common question asked several times on SO. But help me

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.