Click here to Skip to main content
15,907,183 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have 3 dropdownlist and a grid in a form.
I used jquery to populate data to the dropdownlist and 3rd dropdownlist have a autopostback event and selected_indexchanged event.

When I select a value from 3rd dropdownlist then all dropdownist data vanished but this is not fair at all.

I want that data will not be vanished from any dropdownlist and after selecting data from third dropdownlist it will go to the selected_indexchanged event and will popuate data to gridview.
Posted
Updated 5-Oct-10 21:17pm
v2
Comments
NMehta83 12-Oct-10 1:49am    
please add your jquery and aspx page code so that we can find where you have made the mistake?

Some of the choice you have are:

1. Wrap third drop down list inside an UpdatePanel if you already have not done this.
Register all your JS related code (.js files & script blocks) using ScriptManager on page load event.

2. Remove auto post back from the drop down and use "page methods" to call any server side function from java script.

3. Remove auto post back from the drop down and use any of the AJAX methods in jQuery to call your code behind function.

Hope this helps.
 
Share this answer
 
I used jquery to populate data to the dropdownlist and 3rd dropdownlist have a autopostback event and selected_indexchanged event.
When I select a value from 3rd dropdownlist then all dropdownist data vanished but this is not fair at all.

This is happening due to ViewState. When you are populating data to the DropDownList using JQuery, the ViewState remains same as it was during page load. And autopostback causes 1st and 2nd DropDownLists to blank as it was loaded first time.

I want that data will not be vanished from any dropdownlist and after selecting data from third dropdownlist it will go to the selected_indexchanged event and will popuate data to gridview.


Why don't you use an UpdatePanel and use a trigger asynchronously with Selected_IndexChanged event to populate the GridView. Hope this will help you.
 
Share this answer
 
just do autopostback = false

lol
 
Share this answer
 
Comments
saini arun 12-Oct-10 2:02am    
Disabling autopostback will restrict the control from calling selected_indexchanged in code behind.

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