提交后不需要刷新页面 [英] Not Required Refreshing Page After Submit

查看:100
本文介绍了提交后不需要刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生,

当我单击Default.aspx页面的Submit按钮时,即使我要执行将数据插入数据库的操作,页面也正在刷新,我检查了提交后始终调用get方法".如果有任何想法,请给出解决方案..

Hello Sir,

When I Clicking on Submit Button of Default.aspx page , Page is refreshing even i want to perform insert the Data into Database , "I checked always call get method after submit" . Please give the solution if any Idea You have guyz..

推荐答案

在我回答您的问题之前,您将很高兴知道ASP.NET是服务器辅助语言.这意味着无论ASP.Net中发生什么操作,都将在服务器上对其进行处理.为了完成此过程,浏览器将HTTP请求发送到服务器,然后服务器处理该请求并将响应发送回浏览器,然后浏览器将页面呈现给您.由于此活动,您的页面似乎刷新了.

您可以通过使用AJAX避免这种情况. AJAX允许您进行部分回发.现在回到您的问题,您将不得不使用AJAX控件工具包的UpdatePanel控件.

请参考这些链接以开始使用:
1. http://ajax.net-tutorials.com/controls/updatepanel-control/ [ ^ ]
2. http://msdn.microsoft.com/en-us/library/bb386454.aspx [ ^ ]
3. http://www.asp.net/ajax/tutorials/understanding- asp-net-ajax-updatepanel-triggers [ ^ ]
4. 通过按钮单击或下拉列表中的代码隐藏触发AJAX UpdatePanel [ ^ ]

希望这会有所帮助.
祝一切顺利.
Before I answer your question, It would be interesting for you to know that ASP.NET is a server side language. It means that whatever operations happen in ASP.Net they are processed on the server. For this process to complete your browser sends the HTTP request to the server, the server then processes the request and sends the response back to the browser, browser then renders the page to you. Because of this activity your page seems to refresh.

You can avoid this by using AJAX. AJAX allows you to have partial postback. Now coming back to your question, you will have to use the UpdatePanel control of the AJAX control toolkit.

Refer these links to get started :
1. http://ajax.net-tutorials.com/controls/updatepanel-control/[^]
2. http://msdn.microsoft.com/en-us/library/bb386454.aspx[^]
3. http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers[^]
4. Triggering AJAX UpdatePanel from a Button Click or DropDownList Selection Change in Code-Behind[^]

Hope this helps.
All the best.


尝试一下.

将提交"按钮放置在更新面板"中,如

Try this one.

Place the Submit button in Update Pannel like

<asp:ScriptManager ID="scriptmanager" runat="server" >

<asp:UpdatePanel ID="UpdatePanel" runat="server" >
 <contenttemplate>
          <asp:Button ID="btnsubmit" runat="server" Text="Submit" />
 </contenttemplate>


如果您不想回发,请使用HTML控件.

只需尝试一下可能会有所帮助

If you dont want postback then use HTML control''s.

Just try this might help

<asp:button ID="Button1" runat="server" text="Button" OnClientClick="return false;" />


这篇关于提交后不需要刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆