将数据保存到db(sqlsever)后显示nessage框 [英] Show nessage box after saving data into db(sqlsever)

查看:131
本文介绍了将数据保存到db(sqlsever)后显示nessage框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将数据保存到db(sqlserver)后如何显示消息框
??
早些时候,我正在使用像这样的javascript警报

how to show the message box after saving the data in db(sqlserver)
??
earlier i was using javascript alert like this

public static void ShowMessage(string strMessage,Page pgno)
{
    Label lbl = new Label();
    lbl.Text = "<script type='text/javascript' language='javascript'>" + Environment.NewLine+ "window.alert('" + strMessage + "');</script>";
    pgno.Controls.Add(lbl);

}



但由于放置了更新面板和asp:updateprogress,因此无法正常工作.
保存数据后,是否可以使用任何ajax消息框. 我知道"ConfirmButtonExtender"
但是将数据保存到db(sqlserver)后,我们可以使用它来显示确认消息吗?
或更好1.
而且我不想在使用上面的消息框之前使用消息框.

在此先感谢



but since putting update panel and asp:updateprogress Its not working.
Is there any ajax message box to use after saving the data.??
I know the "ConfirmButtonExtender"
but can we use it to show the confirmation message after saving the data into db(sqlserver)
Or better 1 .
And I dont want to use the message box earlier I was using the above one.

thanks in advance

推荐答案

不要使用Label来渲染javascript,否则每次页面发布后都会收到错误消息(Label保留值默认情况下,EnableViewState为true).

使用更新面板时,只有页面的一部分会刷新,如果要从更新面板中触发一些javascript,则需要在ScriptManager中注册脚本.

像这样

Don''t use Label to render you javascript, otherwise you will get the error message every time when your page gets post(Label retains the values as by default the EnableViewState is true for it).

When you are using update panel then only a part of the page gets refresh and if you want fire some javascript from the update panel in that case you need to register your script in the ScriptManager.

like this

ScriptManager.RegisterClientScriptBlock(....)



有关此问题的更多详细信息,请通过以下 http://fredrik.nsquared2.com/ViewPost.aspx?PostId=430 [ ^ ]



for more details on this go through this http://fredrik.nsquared2.com/ViewPost.aspx?PostId=430[^]


这篇关于将数据保存到db(sqlsever)后显示nessage框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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