Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I have two drop down lists - ddl1 and ddl2 and a button.
I select a value from ddl1 which fires ddl1_selectedIndexChanged event.
On occurance of abovesaid event, ddl1 selected value goes to database in a SELECT statement in WHERE Clause to fetch some rows of required data.
This new data table now populates ddl2.
Now I select a value from ddl2.
I press the button.
Now I want to use the ddl2_selected value in button_click event.
What happens is when I press the button, ddl1_selectedIndexChanged event fires unexpectedly and binds the ddl2 once again and hence I loose the ddl2_selectedValue.

I have not used AJAX or Update Panel in my page.
ASP.NET 4.0.
ddl1 - EnableViewState True, PostBack = True
ddl2 - EnableViewState True, PostBack = False

Please help me out.
Thanks in advance.
Posted
Comments
anil.luck 6-Dec-12 13:21pm    
Can you please share your code in which you are getting stuck?it will be better to track the bug.

1 solution

Hi Everyone,

I resolved the issue by going through a couple of more blogs over net.
What I was doing was I wrote these entire set of controls in asp Panel.
The viewState property of this panel was set to False.
As soon as I changed it to true, the unwanted selectedindexchanged event got suppressed.

This got me through. :)

But, it was a hunch.
I did not yet got the reason why this happened ?

Explanations are most welcome.

@Anil: Thanks fot the concern.
 
Share this answer
 

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