Click here to Skip to main content
15,565,403 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
Dear All,

I am using js function to add items in dropdownlist.All items are added perfectly but when I want to add selected value from that in DB,On clicking button the dropdownlist gets reset on postback.

How can I stop this.

Please help.
looking for valuable solutions/suggestion of yours,
Thanks in advance
Supriya
Posted
Updated 25-May-16 5:43am
v2

C#
if(!Page.IsPostBack)
{
//bind your dropdown here
}
 
Share this answer
 
v2
Comments
Supriya Srivastav 10-Jan-12 2:12am    
I have to use js for binding dropdown not server side code.
This will resolve your problem.

http://forums.asp.net/t/1275211.aspx[^]
 
Share this answer
 
Hi,

Put your page content of aspx in <update panel=""> of ajax to avoid the pageload when ever you are selecting some item in the dropdown.

or

write a javascript function that will be called when the dropdown selected index changed event occurs.
function()
{
get the value selected based on the question number.
reset the dropdown.
}


Hope this helps.
 
Share this answer
 
v2
set the AutoPostBack Property of your DropDownList to True
 
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