在提交按钮上显示消息 [英] display message on submit button

查看:76
本文介绍了在提交按钮上显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将数据保存到提交按钮后,我使用下面的代码来显示消息,但其工作正常,但有时不显示消息,请在此帮助我....

I used below code for display message after data save on submit button its working fine but sometime not show message please help me in this....

string msg = "Data saved successfully .";
 ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('" + msg + "');window.location='Home.aspx';", true);

推荐答案

引用: ^ ]
Asp.net使用JavaScript在后台显示警报消息 [^ ]
Refer: How to show the message and redirect to other page in ASP.NET[^]
Asp.net show alert message from code behind using javascript[^]


我认为有时您的邮件带有特殊字符,例如'' (Single Quote) or " (Double Quote).尝试从msg 变量中删除该变量.
I think sometimes your message is coming with special characters like '' (Single Quote) or " (Double Quote). Try removing that from the msg variable.
string msg = "Doesn't match the words .";
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Notification : " + msg + "');window.location='Home.aspx';", true);



希望对您有所帮助.
--Amit



Hope it helps.
--Amit


这篇关于在提交按钮上显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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