onClientClick does not work correctly after deploying

C

cyrus

Hi everybody,

I have created a simple web form which contains a repeater. every item of
the repeater has a button to delete the tiem.



my web form uses Resource files to globalizing the form (multiLanguage). the
value of the resource string is saved in a asp:hidden control to be used
later in a javascript function, so in the following code ConfirmMessage is a
asp:hidden control which saves the value of the properties of the resource
files.

So the value of ConfirmMessage is a confirm message from Resource files in 4
languages which will be showen when a client click on the RemoveBtn to delete
an item.



in developing environment everything works good and i deploy it to
production. within the production machine I browse to my site
(http://mydomain.com) and here everything works good, I get the confirm
message and when I click on Cancel it nothing happen (the item is not
deleted). But the problem is when I browse to production from another machine
it removes the item even when I click Cancel. it seems the javascript does
not works at all. it do a reload and it seems to go in to the onClick event.

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}") %>' />

<asp:Button ID="RemoveBtn" runat="server" Text="delete"
OnClick="RemoveBtn_Click" OnClientClick="return ShowConfirmDelete();" />

</ItemTemplate>

</asp:Repeater>

</asp:Content>
 
B

Bob Barrows [MVP]

cyrus said:
Hi everybody,

I have created a simple web form which contains a repeater. every
item of the repeater has a button to delete the tiem.

There was no way for you to know it (except maybe by browsing through
some of the previous questions before posting yours - always a
recommended practice), but this is a classic (COM-based) asp newsgroup.
ASP.Net is a different technology from classic ASP. While you may be
lucky enough to find a dotnet-savvy person here who can answer your
question, you can eliminate the luck factor by posting your question to
a newsgroup where the dotnet-savvy people hang out. I suggest

microsoft.public.dotnet.framework.aspnet.

There are also forums at www.asp.net where you can find a lot of people
to help you.

HTH,
Bob Barrows
 
E

Evertjan.

=?Utf-8?B?Y3lydXM=?= wrote on 02 sep 2008 in
microsoft.public.inetserver.asp.general:
</asp:Content>

This is a classic asp group. Dotnet questions should be asked in
<microsoft.public.dotnet.framework.aspnet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top