Miguel Flores Miguel Flores - 2 months ago 32
C# Question

How to use Bootbox.alert in C# code

I'm using Bootbox.js instead of js default alerts, all it's ok but I have an .aspx page with pure C# code and I need to show notifications, at the moment I only have a working code for default alert, here is the example:

ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('MyAlertHere.');", true);


My question is, can I be able to use Bootbox alert directly from C# code? How can I do that? Thanks in advance.

Answer

You only need to change alert() to bootbox.alert() so your final code should be like this:

ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "bootbox.alert('Your Alert Here');", true);
Comments