2009-04-14 214 views
1

HI具有这就要求我的aspxAjax表单提交刷新页面

JS

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

myForm.aspx正确加载形式JS脚本。但是,当我提交表单时,它会加载一个新页面。如何停止页面重新加载?

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

您需要取消事件 - 我想在prototype.js中它的Event.stop(),但你将不得不看看在哪里把它

+0

嗯,你的意思是在原来的JS事件(即我的第一个代码块)或通过ASP取消事件。网,谢谢 – frosty 2009-04-14 21:14:11