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

S

SteveS

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.aspx?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
 
M

Marina

What is the configuration of the browser on the other PC? Maybe it has
disabled javascript?
 

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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top