简体   繁体   English

jQuery msgBox在代码后面的执行(C#)

[英]jquery msgBox execution in code behind(c#)

I want to show a message box when user enters wrong ıd or password. 当用户输入错误的ıd或密码时,我想显示一个消息框。 I write following function to the .aspx file: 我将以下函数写入.aspx文件:

 <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: 然后将以下代码写入aspx.cs文件:

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: 使用此插件时 ,必须包含3个文件:

<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 这对我来说很有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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