First write this code in your .ASPX.
<div id="divMessage" runat="server" class="" style="display: none;">
<asp:Literal runat="server" ID="ltlMessage" Text="test"></asp:Literal>
</div>
Then just write this code behind you .CS page.
public static void ShowMessage(string _class, string msg, System.Web.UI.HtmlControls.HtmlGenericControl divMessage, Literal ltlMessage)
{
divMessage.Style.Add("display", "block");
divMessage.Attributes.Add("class", _class);
ltlMessage.Text = msg;
}
try
{
UISettings.ShowMessage("alert alert-success", "Insert Successfully", divMessage, ltlMessage);
}
catch (Exception ex)
{
ShowMessage("alert alert-error", ex.InnerException.Message, divMessage, ltlMessage);
}