$(document).ready(function () {
$(".test123").live("change", function () {
var ddlBrand = "";
ddlBrand = $('#<%= ddlBrand.ClientID %>').val();
if (ddlBrand > 0) {
return confirm('The values entered for this brand will reset. Are you sure you want to change the Brand.');
});
}
});
return false;
});
The problem that i have with the above code is that on Cancel of confirm box i am not able to retain the page state.
Also for the first dropdown selection i do not want the confirm box.
Please help.
If I understand your question correctly, You dont want confirm if ddlBrand change first time, and if confirm calls, Cancel confirmation revert your ddlBrand value with previous selected value. You can try this.
And Check this DEMO