Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
1.00/5 (1 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

Use this one

C#
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.
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900