重定向页面后如何显示消息 [英] How to display the message after redirecting the page

查看:87
本文介绍了重定向页面后如何显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,在将页面重定向到同一页面之后,我将保存数据.在这里,我需要将消息显示为重定向到页面后成功保存的数据.谁能帮我解决这个问题.

在Advance中致谢

Hi,

In my application I am saving the data after that I am redirecting the page to the same page. Here I need to display the message as data saved successfully after redirecting to the page. Can any one help me to solve this problem.

Thanks in Advance

推荐答案

您可以在使用response.write重定向到的页面的页面加载中使用javascript警报.
You can use the javascript alert in the page load of the page you are redirecting to using response.write .


尽管将数据保存在同一页面中,但为什么要重定向到同一页面.我认为无需重定向到同一页面.

顺便说一句,您可以通过两种方式之一显示消息.

方法一:使用消息框.

Why you are re-directing to same page, though you are saving the data in the same page..?? I think No need of redirecting to same page.

by the way, you can display the message either of the two ways.

Method I: using message box.

string strJscript = "<script language='javascript'> alert('Details are saved successfully');</script>";

Page.CLientScript.RegisterClientScriptBlock(this,this.GetType(),"Myscript",strJscript,false);



方法二:
保留一个Label并将消息显示为Label Text.



method II:
keep one Label and display message as Label Text.

Label1.Text="Details are saved sucessfully";



希望对您有帮助..



hope this helps..


protected void Page_Load(object sender, EventArgs e)
{
    // First time logic
    if (!IsPostBack)
    {
        Response.Write("U r success message");
    }
}


这篇关于重定向页面后如何显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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