tags:

views:

300

answers:

1

HI have js script which calls my aspx

JS

new Ajax.Updater('display', '/myForm.aspx?lat=' + lat + '&lng=' + lng + '&zoom=' + zoom, { method: 'get' });

myForm.aspx loads the form correctly. However when i submit the form it loads a new page. How do stop the page reload??

myForm.aspx

<form id="form1" runat="server" >
    <asp:ScriptManager ID="ScriptManager1" runat="server"  EnablePageMethods="true" >
</asp:ScriptManager>    
    <uc1:FlagForm ID="FlagForm1" runat="server" />    
    </form>

FlagForm.ascx

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table>
<tr>
<td>Name:</td>
<td><asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Email:</td>
<td><asp:TextBox ID="TextBoxEmail" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Comments:</td>
<td><asp:TextBox ID="TextBoxComment" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Marketing Opt in:</td>
<td><asp:CheckBox ID="CheckBoxOptIn" runat="server" /></td>
</tr>
<tr>
<td>Data Protection:</td>
<td><asp:CheckBox ID="CheckBoxDataProtection" runat="server" /></td>
</tr>
</table>
<asp:HiddenField ID="HiddenFieldLng" runat="server" />
<asp:HiddenField ID="HiddenFieldLat" runat="server" />
<asp:HiddenField ID="HiddenFieldZoom" runat="server" />
<asp:Button ID="ButtonSend" runat="server" Text="Send" onclick="ButtonSend_Click" />
 <asp:Label ID="LabelResults" runat="server" Text="Label"></asp:Label>
</ContentTemplate>

</asp:UpdatePanel>
+1  A: 

You need to cancel the event - I think in prototype.js it's Event.stop(), but you'll have to have a look at where to put it

adam
hmm, Do you mean the event in the original JS (ie my first code block ) or cancel the event via asp.net, thanks
frosty

related questions