Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 526.3k

Separate class for ShowMessage

Aug 20 2024 2:48 AM

Hi

  I have below code and i want ShowMessage to be definedonce only in the project. Currently i am defining in every form

public void ShowMessage(String Title, String Text, String Type)
{
    Text = Text.Replace("'", "").Replace("/", " ").Replace(";", " ").Replace(":", " ").Replace(",", " ");
    Text = System.Text.RegularExpressions.Regex.Replace(Text, @"\t|\n|\r", " ");
    if (Common.CommonFunction.IE(Request.Browser.Browser))
    {
        Common.MessageBox.Show(Text);
    }
    else
    {
        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + Title + "', '" + Text + "','" + Type + "');", true);
    }
}

Thanks


Answers (1)