浏览器缓存上的后退按钮,而不是在asp web应用程序中重新加载整个页面 [英] back button on browser caches instead of reloading entire page in asp web application

查看:74
本文介绍了浏览器缓存上的后退按钮,而不是在asp web应用程序中重新加载整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快乐星期五专家!



我有一个网站,其中有一个提交按钮,代码如下



Happy Friday Experts!

I have a website, where there is a submit button which has code as below

If Page.IsValid Then
               Dim dsCustInfo As DataSet = New DataSet()
               Dim dsDealerInfo As DataSet = New DataSet()
               Dim dsAsDealerInfo As DataSet = New DataSet()
               Dim dsVehicleInfo As DataSet = New DataSet()
               Dim dsOtherDetails As DataSet = New DataSet()
               InsertData()
               SendEmail()
               ScriptManager.RegisterStartupScript(Page, Page.GetType(), "scr", "closeLoading();", True)
               ClearAll()
               Session.Abandon()
               ViewState.Clear()
               Page.Response.Cache.SetCacheability(HttpCacheability.NoCache)
               '  ClientScript.RegisterStartupScript(Me.GetType(), "myalert", "Your information has been submitted successfully", True)
               Dim message As String = "alert('Your information has been submitted successfully.')"
               ScriptManager.RegisterClientScriptBlock(TryCast(sender, Control), Me.GetType(), "alert", message, True)
           Else
               Dim ms As String = "alert('Please enter required fields.')"
               ScriptManager.RegisterClientScriptBlock(TryCast(sender, Control), Me.GetType(), "alert", ms, True)
           End If







在客户端点击相同的按钮,我有以下javascript代码...






And on the client click of same button, I have following javascript code...

function Valid() {
        debugger;
        var totalRows = $("#<%=gdvLineItems.ClientID %> tr").length;
        if (totalRows != 0) {
            if (Page_ClientValidate("Required") == true) {
                //StartProgressBar()
                PrintPanel();
                blockUI();
                return true;

            }
            else {
                validateAndHighlight();
                alert("Please fill the Required fields");
                return false;
            }
        }
        else {
            alert("Please Add Line Items/ Tires");
            return false;
        }
    }





现在,所有验证工作都很完美。

提交后,我从成功消息后面的代码中收到一条消息,现在我转到了另一个page2.aspx。它没有任何问题。我决定点击浏览器的后退按钮,我看到成功消息,而不是完全显示页面。它显示警报消息(成功消息)。



有人可以帮我这个吗?

我相信我与缓存和回发有关但不知道如何做或做什么



Now, all the validations are working perfectly.
After I submit, I get a message from code behind "Success message" and now I moved to a different page2.aspx. It is loaded without any problem. I decided to click on back button of browser and I see that success message instead of showing me entirely the page. It shows the Alert message (success message) .

Could someone help me with this?
I believe I have something to do with caching and postbacks but not sure how or what to do

推荐答案

(#<% = gdvLineItems.ClientID%> tr)。length;
if(totalRows!= 0){
if(Page_ClientValidate(Required)== true){
// StartProgressBar()
PrintPanel();
blockUI();
返回true;

}
else {
validateAndHighlight();
alert(请填写必填字段);
返回false;
}
}
else {
alert(请添加行项目/轮胎);
返回false;
}
}
("#<%=gdvLineItems.ClientID %> tr").length; if (totalRows != 0) { if (Page_ClientValidate("Required") == true) { //StartProgressBar() PrintPanel(); blockUI(); return true; } else { validateAndHighlight(); alert("Please fill the Required fields"); return false; } } else { alert("Please Add Line Items/ Tires"); return false; } }





现在,所有验证工作都很完美。

提交后,我从成功消息后面的代码中收到一条消息,现在我转到了另一个page2.aspx。它没有任何问题。我决定点击浏览器的后退按钮,我看到成功消息,而不是完全显示页面。它显示警报消息(成功消息)。



有人可以帮我这个吗?

我相信我与缓存和回发有关但不知道如何做或做什么



Now, all the validations are working perfectly.
After I submit, I get a message from code behind "Success message" and now I moved to a different page2.aspx. It is loaded without any problem. I decided to click on back button of browser and I see that success message instead of showing me entirely the page. It shows the Alert message (success message) .

Could someone help me with this?
I believe I have something to do with caching and postbacks but not sure how or what to do


尝试在下面添加到页面加载。

Try adding below to Page Load.
protected void Page_Load(object sender, EventArgs e)
{
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
}


这篇关于浏览器缓存上的后退按钮,而不是在asp web应用程序中重新加载整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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