Monday, June 10, 2013

show message box using RegisterStartupScript scripts

Its easy and common to us but then also we are writing a same code again and again. Here we have made a common function for show message box, which is more simple and better to look, call and apply.

 Step 1: Put below code in Common class file.(in brokingdesk we have already added in CommonHelper.cs file)

//-----------Implementation-------------

   public static void MessageBox(Page p,string msg)

    {

        //System.Web.UI.Page p = new Page();

        ClientScriptManager cm = p.ClientScript;

        cm.RegisterStartupScript(p.GetType(), "alert", "<script>alert('"+msg+"');</script>");

    }
Step 2: how to call
CommonHelper.MessageBox(this.Page, "You Have Not Permission to Add This Client.");
I hope it will help you lots guys. And now its up to on you that how you can use it more and more and more and what you can add in it and provide something better. HAPPY CODING!!!

If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment