Click here to Skip to main content
14,641,378 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have 14 User control.

When This 14 User Control added in homepage Dynamically From Code behind Page
Then My Homepage Page_init() and Page_Load() Event Call 14 Times
So Why Homepage Load 14 Times

Please Help

What I have tried:

Adding Usercontroll In Homepage Loading Issue
Posted
Updated 10-Mar-16 18:04pm
Comments
Sinisa Hajnal 10-Mar-16 2:37am
   
Why are you not adding needed controls at once? Reloading probably happens because you load in event handlers (such as checkbox change or drop down selection. But without any code shown, this is just wild guess.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Use this one

usercontrols_SimpleControl ucSimpleControl = 
  LoadControl("~/usercontrols/SimpleControl.ascx") 
  as usercontrols_SimpleControl;

Placeholder1.Controls.Add(ucSimpleControl);


For more visit Dynamic Loading of ASP.NET User Controls[^]

I hope this will resolve your problem.
   
Comments
Rahulgupta.hanu 11-Mar-16 0:49am
   
Is It Possible To Open Other Page On Menu Click from homepage if Homepage Usercontrol Loading Process Running.

I want To Stop Homepage load and open Menu Page after click on Menu.
Arkadeep De 11-Mar-16 2:08am
   
Put isPostBack in Page_Load method to stop binding the page after getting post back.
Rahulgupta.hanu 11-Mar-16 2:30am
   
Any other option because when I use ispostback then my homepage not loaded properly
Arkadeep De 11-Mar-16 6:30am
   
Why? Whats the problem of loading the home page if you use IsPostback

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100