简体   繁体   中英

jquery msgBox execution in code behind(c#)

I want to show a message box when user enters wrong ıd or password. I write following function to the .aspx file:

 <script type="text/javascript">
    function warningMessage() {
        $.msgBox({
            title: "Hatalı Giriş",
            content: "Kullanıcı numarası ya da şifre hatalı...",
            type: "error",
            buttons: [{ value: "Ok" }]              
        });
    }
</script>

and I write the following code to the aspx.cs file:

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "warningMessage  ", "warningMessage()", false);

but this code does not work. Can you help me?

While using this plugin it is necessary to include 3 files:

<script src="Scripts/jquery-2.0.0.js" type="text/javascript"></script>
<script src="Scripts/jquery.msgBox.js" type="text/javascript"></script>
<link href="Styles/msgBoxLight.css" rel="stylesheet" type="text/css">  

I used this code on client-side:

<script type="text/javascript">
    function warningMessage() {
        $.msgBox({
            title: "Hatalı Giriş",
            content: "Kullanıcı numarası ya da şifre hatalı...",
            type: "error",
            buttons: [{ value: "Okay"}]  
        });
    }
</script>  

On server-side:

Page.ClientScript.RegisterStartupScript(this.GetType(), null, "warningMessage();", true);  

IT WORKS WELL FOR ME

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM