How can I display a messagebox in ASP.NET?

前端 未结 13 2152
死守一世寂寞
死守一世寂寞 2020-11-30 11:30

I want to show a message box on the successful save of any item. I googled it and tried different solutions, but none of them worked. Here is the code I am using:

         


        
13条回答
  •  情书的邮戳
    2020-11-30 11:48

    Make a method of MsgBox in your page.


    public void MsgBox(String ex, Page pg,Object obj) 
    {
        string s = "";
        Type cstype = obj.GetType();
        ClientScriptManager cs = pg.ClientScript;
        cs.RegisterClientScriptBlock(cstype, s, s.ToString());
    }
    

    and when you want to use msgbox just put this line

    MsgBox("! your message !", this.Page, this);
    

提交回复
热议问题