2

i want display alert bootstrap message in div html from code behind after some action, i use Response.Write for display message:

<html>
   <head>
       <link href="bootstrap.min.css"/>
   </head>
   <body>

        <div id="containerMsg"></div>

        Login design

     <script src="jquery.min.js"></script>
     <script src="bootstrap.min.js"></script>
   </body>
</html>

//

string alert concat c# :

public static string msgError(string msg)
{
        string strHtml = "";

        strHtml += "<div class='alert alert-warning'>";
        strHtml += "    <strong>error login:</strong>"+msg;
        strHtml += "</div>";

        return strHtml;
}

//Code behind button click

 if(loginBussines.isValid(user))
 {
      Response.Write("<script> $('#containerMsg').html("+UtilsMessage.msgError("invalid credentials")+"</script>") }
Danilo
  • 91
  • 1
  • 1
  • 9
  • Possible duplicate of [Calling JavaScript Function From CodeBehind](http://stackoverflow.com/questions/5731224/calling-javascript-function-from-codebehind) – Sani Huttunen May 12 '17 at 00:42

1 Answers1

0

Hi you can use JavaScript/Jquery for your alert.

here's a simple framework called sweetalert. very simple to use

sample: swal("hello world!");

here is the link. http://t4t5.github.io/sweetalert/

Drew Aguirre
  • 375
  • 2
  • 15