Hi everybody,
I have created a little application which contains some datalists, repeaters. each item of the datalists or repeaters has a button which is used to delete the item. I have used onClientClick to get a confirm message when you want to delete an item. My code is working correctly in developing environement (VS 2008 .net 2.0). but I deploy it to production (same machine but another local disk - d it does not work correctly. It generates the confirm message but it deletes the item even when I click on Cancel. Thank you for any help.
here is my code:
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript" type="text/javascript">
function ShowConfirmDelete() {
var theMessage = document.getElementById('<%=ConfirmMessage.ClientID%>').value;
return confirm(theMessage);
}
</script>
<asp:Repeater ID="DataList1" runat="server" DataSourceID="SqlDataSource1" >
<ItemTemplate>
asp:Label ID="itemdateLabel" runat="server" Text='<%# Eval("CreatedDate","{0:d}") %>' />
<asp:Button ID="RemoveBtn" runat="server" Text="delete" OnClientClick="return ShowConfirmDelete();" />
</ItemTemplate>
</asp:Repeater>
</asp:Content>
I have created a little application which contains some datalists, repeaters. each item of the datalists or repeaters has a button which is used to delete the item. I have used onClientClick to get a confirm message when you want to delete an item. My code is working correctly in developing environement (VS 2008 .net 2.0). but I deploy it to production (same machine but another local disk - d it does not work correctly. It generates the confirm message but it deletes the item even when I click on Cancel. Thank you for any help.
here is my code:
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript" type="text/javascript">
function ShowConfirmDelete() {
var theMessage = document.getElementById('<%=ConfirmMessage.ClientID%>').value;
return confirm(theMessage);
}
</script>
<asp:Repeater ID="DataList1" runat="server" DataSourceID="SqlDataSource1" >
<ItemTemplate>
asp:Label ID="itemdateLabel" runat="server" Text='<%# Eval("CreatedDate","{0:d}") %>' />
<asp:Button ID="RemoveBtn" runat="server" Text="delete" OnClientClick="return ShowConfirmDelete();" />
</ItemTemplate>
</asp:Repeater>
</asp:Content>