Ajax表单提交重新加载页面

时间:2009-04-14 20:24:05

标签: asp.net-ajax

HI有js脚本调用我的aspx

JS

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

myForm.aspx正确加载表单。但是,当我提交表单时,它会加载一个新页面。怎么停止页面重装?

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 个答案:

答案 0 :(得分:1)

你需要取消这个事件 - 我认为在prototype.js中它是Event.stop(),但是你必须看看它放在哪里