Dropdownlist not showing previous value

Amnadrstanolon

New Member
I have an asp.net dropdownlist control with autopostback false.I have written js code to display confirm message while dropdown value changed.\[code\]function ConfirmAbsent(ddlPresence) { if (ddlPresence != null) { var myValue = http://stackoverflow.com/questions/12619976/ddlPresence.options[ddlPresence.selectedIndex].text; var blnAbsent = confirm("This will mark as "+ myValue +". Please confirm clicking OK."); if (blnAbsent) { return true; } else { return false; } } }\[/code\]And add this attribute to dropdownlist like below\[code\]ddlUserPresence.Attributes.Add("onchange", "if (!ConfirmAbsent(" + ddlUserPresence.ClientID + ")) return; else __doPostBack('" + ddlUserPresence.UniqueID + "', '');");\[/code\]When i click on ok button it postback the page working correctly, but when i click on cancel button it is not showing me the previous value instead showing the current value.So when i click on cancel button it should show me the previous value.Please help.
 
Back
Top