Click here to Skip to main content
12,072,540 members (59,157 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET4
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 6-Dec-12 8:02am
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

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

Solution 1

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. Smile | :)

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

Explanations are most welcome.

@Anil: Thanks fot the concern.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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