Hi Robert,
Try the code below?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
Protected Sub DropDownList1_S electedIndexCha nged _
(ByVal sender As Object, ByVal e As System.EventArg s)
Label1.Text = DropDownList1.S electedValue.To String
End Sub
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArg s)
DropDownList1.A ttributes.Add _
("OnChange", "if (!confirm('Chan ge this?')){return };")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Confir m Dropdownlist</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:dropdownli st id="DropDownLis t1" runat="server"
autopostback="T rue"
onselectedindex changed="DropDo wnList1_Selecte dIndexChanged">
<asp:listitem selected="True" >Red</asp:listitem>
<asp:listitem>G reen</asp:listitem>
<asp:listitem>B lue</asp:listitem>
</asp:dropdownlis t><br />
<br />
<asp:label id="Label1" runat="server"> </asp:label>  ;</div>
</form>
</body>
</html>
<ro****@orisoft .co.ukwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
>I have a dropdownlist with the autopostback set to true. I want the
user to be confirm whether they do indeed want to change the value,
which on post back fires a server side event (selectedindexc hanged).
I have tried adding an onchange attribute "return confirm('sure u wanna
change this?';") but it will not postback regardless of the confirm
result and the value in the list does not revert back if cancel
selected.
Is there a solution?