I have a simple JS pop up "are you sure..." window, along with a dropdownlist and asp:button.
What I want when I click the button is to get this message:
"Are you sure you want to perform <%= ACTION %>?"
where ACTION is a string coming from dropdownlist.SelectedItem.Text.
The following does not seem to work:
OnClientClick="return confirm('Are you sure you want to perform <%= ACTION %>? );
It actually just prints the <%= ACTION %> instead of the value.
I have also tried:
function testMe() {
return confirm('Are you sure you want to perform ' + document.getElementById('<%= hfAction.ClientID %>').value + '?');
}
OnClientClick="testMe();"
But the above causes postback regardless of clicking cancel or OK.
Which is the correct usage?