Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > onClientClick does not work correctly after deploying

Reply
Thread Tools

onClientClick does not work correctly after deploying

 
 
cyrus
Guest
Posts: n/a
 
      09-02-2008
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.ClientI D%>').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>


 
Reply With Quote
 
 
 
 
Jeff Dillon
Guest
Posts: n/a
 
      09-02-2008
"cyrus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.ClientI D%>').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>
>
>


View Source


 
Reply With Quote
 
 
 
 
cyrus
Guest
Posts: n/a
 
      09-03-2008
what do you mean??

"Jeff Dillon" wrote:

> "cyrus" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.ClientI D%>').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>
> >
> >

>
> View Source
>
>
>

 
Reply With Quote
 
Jeff Dillon
Guest
Posts: n/a
 
      09-04-2008

"cyrus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> what do you mean??
>
> "Jeff Dillon" wrote:
>
>> "cyrus" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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.ClientI D%>').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>
>> >
>> >

>>
>> View Source
>>
>>
>>


Are you familiar with View Source in IE? Look at the page after it renders,
and look for differences.


 
Reply With Quote
 
cyrus
Guest
Posts: n/a
 
      09-05-2008

Thank you again,

Actually I dont familiar with view soruce and dont understan, i am going to
google about it.


"Jeff Dillon" wrote:

>
> "cyrus" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > what do you mean??
> >
> > "Jeff Dillon" wrote:
> >
> >> "cyrus" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > 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.ClientI D%>').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>
> >> >
> >> >
> >>
> >> View Source
> >>
> >>
> >>

>
> Are you familiar with View Source in IE? Look at the page after it renders,
> and look for differences.
>
>
>

 
Reply With Quote
 
Jeff Dillon
Guest
Posts: n/a
 
      09-05-2008

"cyrus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Thank you again,
>
> Actually I dont familiar with view soruce and dont understan, i am going
> to
> google about it.
>
>
> "Jeff Dillon" wrote:
>
>>
>> "cyrus" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > what do you mean??
>> >
>> > "Jeff Dillon" wrote:
>> >
>> >> "cyrus" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > 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.ClientI D%>').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>
>> >> >
>> >> >
>> >>
>> >> View Source
>> >>
>> >>
>> >>

>>
>> Are you familiar with View Source in IE? Look at the page after it
>> renders,
>> and look for differences.
>>
>>
>>


If you are using Internet Explorer, right click on the page, and choose View
Source. It will show all the HTML markup and Javascript too. It sounds like
your Javascript isn't rendering correctly


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnClientClick with confirm doesn't work Mauricio Pires ASP .Net Web Controls 3 01-21-2009 08:24 AM
onClientClick does not work correctly after deploying cyrus ASP General 2 09-02-2008 02:54 PM
OnClientClick in an asp:LinkButton - using confirm() doesn't work inevery browser dddan ASP .Net 2 12-14-2007 08:16 PM
why does Response.ContentType = "text/plain"; not work correctly? =?Utf-8?B?bGV0dWNlIGRhbmNl?= ASP .Net 3 10-26-2006 06:39 PM
deploying and re-deploying ASP.Net applications =?Utf-8?B?VG9tIE4=?= ASP .Net 2 02-04-2004 09:31 PM



Advertisments