473,320 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

This works on my locahost, but not on a remote server?

Hello. This problem is perplexing me.

I have a asp:button which runs a javascript function when it is clicked. It
returns a true or false depending if a postback is needed. This works great
when I run it on my development pc. But, when I run it from another
computer, it ALWAYS does a postback, even if it returns false. I have no
ideas why????

The plot thickens... I don't know if this really matters or not, but this
button is in a datagrid.

Can anyone explain to me why the javascript function posts back????? The
code is posted below.

Thank you in advance!

SteveS

******ASPX CODE************

<asp:Datagirid......>
..
<asp:TemplateColumn HeaderText="Deny" ItemStyle-HorizontalAlign=Center
HeaderStyle-HorizontalAlign=Center>
<ItemTemplate>
<asp:Button text="Deny" ID="btnDeny" Runat="server"
CommandName="btnDeny"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
..
</asp:Datagrid>

<script lang=javascript>
function OpenDenyWindow(changeId, btn) {
var ret = false
retVal=window.showModalDialog('DenialEmailForm.asp x?id=' +
changeId+'&mem='+document.Form1.hdnMemId.value,'', '');
alert ("retval = " + retVal)
if (retVal == "Successful") {
//return true
ret = true
}
else {
//return false
ret = false
}
alert(ret);
// *** even if this function returns a FALSE, the form is still posted
when I am not running the web page from my local host.
return ret;
}
**** CODE BEHIND****

Private Sub grdList_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdList.ItemCreated
'ADD THE JAVASCRIPT TO TO THE BUTTON
Dim ctrlDeny As Button = CType(e.Item.FindControl("btnDeny"),
Button)
If Not IsNothing(ctrlDeny) Then
Dim grid As DataGrid = CType(sender, DataGrid)
ctrlDeny.Attributes.Add("onclick", "return OpenDenyWindow("
& grid.DataKeys(e.Item.ItemIndex).ToString & ", this); return false;")
End If
End Sub


Nov 18 '05 #1
1 1501
What is the configuration of the browser on the other PC? Maybe it has
disabled javascript?

"SteveS" <ss*****@trendmls.com> wrote in message
news:uZ**************@TK2MSFTNGP11.phx.gbl...
Hello. This problem is perplexing me.

I have a asp:button which runs a javascript function when it is clicked. It returns a true or false depending if a postback is needed. This works great when I run it on my development pc. But, when I run it from another
computer, it ALWAYS does a postback, even if it returns false. I have no
ideas why????

The plot thickens... I don't know if this really matters or not, but this
button is in a datagrid.

Can anyone explain to me why the javascript function posts back????? The
code is posted below.

Thank you in advance!

SteveS

******ASPX CODE************

<asp:Datagirid......>
.
<asp:TemplateColumn HeaderText="Deny" ItemStyle-HorizontalAlign=Center
HeaderStyle-HorizontalAlign=Center>
<ItemTemplate>
<asp:Button text="Deny" ID="btnDeny" Runat="server"
CommandName="btnDeny"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
.
</asp:Datagrid>

<script lang=javascript>
function OpenDenyWindow(changeId, btn) {
var ret = false
retVal=window.showModalDialog('DenialEmailForm.asp x?id=' +
changeId+'&mem='+document.Form1.hdnMemId.value,'', '');
alert ("retval = " + retVal)
if (retVal == "Successful") {
//return true
ret = true
}
else {
//return false
ret = false
}
alert(ret);
// *** even if this function returns a FALSE, the form is still posted when I am not running the web page from my local host.
return ret;
}
**** CODE BEHIND****

Private Sub grdList_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdList.ItemCreated 'ADD THE JAVASCRIPT TO TO THE BUTTON
Dim ctrlDeny As Button = CType(e.Item.FindControl("btnDeny"),
Button)
If Not IsNothing(ctrlDeny) Then
Dim grid As DataGrid = CType(sender, DataGrid)
ctrlDeny.Attributes.Add("onclick", "return OpenDenyWindow(" & grid.DataKeys(e.Item.ItemIndex).ToString & ", this); return false;")
End If
End Sub



Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jonezy | last post by:
my test server is win2k server, the script works fine, loads the movie, allows user selection etc. however when i access the same script on my remote server none of the requesting files load. the...
1
by: Steve | last post by:
I'm trying to get some data out of SQLServer on our Webserver. I built the database on my local machine and the code pages are on my C: drive and the virtual folders are in IIS running on my...
1
by: SteveS | last post by:
Hello. This problem is perplexing me. I have a asp:button which runs a javascript function when it is clicked. It returns a true or false depending if a postback is needed. This works great...
1
by: Thom Little | last post by:
I have a simple web service that requires no input and returns a character string. I created the service and FTPd it to a remote server. The .dll to the .bin directory and the single .asmx file...
4
by: Abhi | last post by:
Hi All, I have a web service method which works fine when called from my local machine i.e. from localhost but when I publish the web services to a remote machine it throws an invalid cast soap...
12
by: smerf | last post by:
I have searched high and low (and even in some places I'd like to forget I ever saw) for the information that will tell me exactly how the Nat2Nat server for UltraVNC works (not just a vague...
15
by: Mark Goldin | last post by:
Is it possible (for testing purposes) turn a locahost into somename.com? Thanks
8
by: John | last post by:
Hi We had an sbs 2003 with isa 2000 server. We wre able to access a remote sql server (hosted at our web host) just fine. We replaced the server with a new sbs 2003 r2 with isa 2004 server and...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.