Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Popup window after submit

Tags:

c#

asp.net

Just to ask a straight question, when I complete adding some data in my page and click submit button, how can I make a popup window saying that the information has been successfully added in database instead of make a new page? Is there any ways that I can do? Any website to be referred? Thanks

like image 861
Color Shadow Avatar asked Jul 25 '26 14:07

Color Shadow


1 Answers

You may create a re-usable function for it .

  public void Show(string msg)
  {
            Page page = HttpContext.Current.Handler as Page;
            if (page != null)
            {
                ScriptManager.RegisterStartupScript(page, page.GetType(), "msg", "alert('" + msg + "');", true);
            }
  }

and in submit button call like this.

 protected void btnSubmit_Click(object sender, EventArgs e)
 {
       // Your Code for submit 
        Show("Save Success");
 } 
like image 116
4b0 Avatar answered Jul 27 '26 02:07

4b0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!