Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET4.0
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 7:02am
Comments
anil.luck at 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
0 OriginalGriff 355
1 Maciej Los 180
2 Richard MacCutchan 115
3 arvind mepani 104
4 Tino Fourie 92


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