最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Show Alert message on button click after saving the data asp.net - Stack Overflow

matteradmin4PV0评论

I want to show a message "Successfully added" after saving the record to the database on button click which already having a JS function for some validation on the data. i have tried the following code but nothing is showing.

ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert",
"<script>alert('" + "Successfully added" + "');</script>", false);

How to show the success message in a popup with at the end save process?

I want to show a message "Successfully added" after saving the record to the database on button click which already having a JS function for some validation on the data. i have tried the following code but nothing is showing.

ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert",
"<script>alert('" + "Successfully added" + "');</script>", false);

How to show the success message in a popup with at the end save process?

Share Improve this question asked May 30, 2012 at 11:54 GeethGeeth 5,34323 gold badges86 silver badges136 bronze badges 2
  • Check this SO thread stackoverflow./questions/1920397/… – user1921 Commented May 30, 2012 at 11:57
  • That reply's are not working for me. – Geeth Commented May 30, 2012 at 12:08
Add a ment  | 

2 Answers 2

Reset to default 6

Use Response.Write("<script>alert('Successfully added');</script>"); on button code behind.

try this,

System.Web.HttpContext.Current.Response.Write("<script language=\"JavaScript\">alert(\"write here what you want\")</script>");
Post a comment

comment list (0)

  1. No comments so far