0

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?

the4u
  • 83
  • 1
  • 2
  • 8

1 Answers1

0

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

Bhavik
  • 4,836
  • 3
  • 30
  • 45
  • this does not work too. but when I change the true as false it shows warningMessage(); in the web page's top part – the4u Jun 22 '13 at 10:14
  • Well it does.. Change the code of function warningMessage() to this `{ alert('Check'); }` and comment everything else.. And then try it.. – Bhavik Jun 22 '13 at 10:19
  • Thanks but I know it. I want to give a title to message box and I learned that I must use jquery msgBox built-in method to give title. – the4u Jun 22 '13 at 10:23
  • That means the problem is not in the code-behind call... But in the jQuery you created.. And I don't know if `$.msgBox` is a function.. Till I understand you are using some plugin and haven't included its `.js` file – Bhavik Jun 22 '13 at 10:30
  • I have added followings to head tag and I added the files required to my project. the problem may originate from $.msgBox – the4u Jun 22 '13 at 10:34
  • Which pulug-in are you using..? – Bhavik Jun 22 '13 at 10:40
  • I am using jquery-1.8.0.js and jquery.msgBox.js – the4u Jun 22 '13 at 10:42
  • If you have used [this plug-in](http://jquerymsgbox.ibrahimkalyoncu.com) have you included the style sheet.. – Bhavik Jun 22 '13 at 10:46
  • [link](http://jquerymsgbox.ibrahimkalyoncu.com/) I saw msgBox method in this site but it does not show how to use it – the4u Jun 22 '13 at 10:47
  • yes it works thanks a lot. I have added wrong file to my project ( jquery-1.8.0.js ) – the4u Jun 22 '13 at 10:58