Click here to Skip to main content
15,902,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have created a web user control. I added DropDownList in it. I have handled the Page_Load event of my user control. The Page_Load handler is called when the page containing my user control is loaded. But when i change the selected value in the dropdownList in my user control the page_load handler of my user control is called again and all the values in my user control are refreshed. I can not figure out this problem.

Please help me.
Posted

If your page refreshes, the events are called, why is this an issue ?
 
Share this answer
 
Bind the dropdown after checking IsPostBack property,

if(!IsPostBack)
{
  BindDDL();
}


I think this will solve your problem.
 
Share this answer
 
I think Arun Jacob is right.

The problem might be, every time you bind your drop down list. Instead bind only when page loads first time. Reply if the problem not solved.
 
Share this answer
 
v2

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