locked
Message prompt RRS feed

  • Question

  • User364663285 posted

    Hi,

    Is there any other way to show the prompt message instead of 

    Page.ClientScript.RegisterStartupScript(this.GetType(), "通知", "javascript:alert('生日日期格式有问题。');", true);

    Wednesday, December 27, 2017 9:19 AM

All replies

  • User475983607 posted

    Yes, there are many ways to prompt the user.

    It is impossible to provide guidance without understanding the problem you are trying to solve.  Maybe the issues is the alert fires too late in the process? Or maybe you want a different prompt style?  Can you explain the problem you are trying to solve?

    Wednesday, December 27, 2017 2:20 PM
  • User364663285 posted

    When showing the prompt message below, it is having unnecessary messages highlighted below. How to disable that?

    https://app.box.com/s/g5ckzal6hoee8lrsz8g1ai5g3luf568i

    to this URL

    http://my-friend.co/UserMaintenance2/Default.aspx?userid=mc4&readonly=n

    But normally the highlighted part in above, would not be shown.

    Thursday, December 28, 2017 2:09 AM
  • User-1838255255 posted

    Hi wmec,

    If you want to use other dialog to show message, please check the jQuery-UI dialog:

    https://jqueryui.com/dialog/ 

    Also if you still meet this issue, i hope you could post your code for us to test, because i can't debug it in the site directly. 

    Best Regards,

    Eric Du 

    Thursday, December 28, 2017 8:35 AM
  • User364663285 posted

    Hi,

    How to replace the following line, which is in code behind?

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "通知", "javascript:alert('生日日期格式有问题。');", true);
    
    
    Thursday, December 28, 2017 8:43 AM
  • User-1838255255 posted

    Hi wmec,

    According to your description, please check the following sample code:

    Sample Code:

    <head runat="server">
        <title>Dialog</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
        <script>
            function show() {
                $("#dialog").dialog();
                return false;
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <div id="dialog" title="通知" style="display: none;">
                    <p>生日日期格式有问题!</p>
                </div>
                <asp:Button ID="Button1" runat="server" Text="Show Alert" OnClick="Button1_Click" />
                <asp:Button ID="Button2" runat="server" Text="Show jQuery-UI Prompt" OnClientClick="return show()" />
            </div>
        </form>
    </body>
     protected void Button1_Click(object sender, EventArgs e)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "通知", "javascript:alert('生日日期格式有问题。');", true);
            }
    

    Best Regards,

    Eric Du

    Friday, December 29, 2017 2:03 AM
  • User364663285 posted

    How to run "show()" in code behind?

    Friday, December 29, 2017 4:49 AM
  • User-1838255255 posted

    Hi wmec,

    Please check the following code:

    <head runat="server">
        <title>Dialog</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
        <script>
            function show() {
                $("#dialog").dialog();
                return false;
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <div id="dialog" title="通知" style="display: none;">
                    <p>生日日期格式有问题!</p>
                </div>
                <asp:Button ID="Button1" runat="server" Text="Show Alert" OnClick="Button1_Click" />
            </div>
        </form>
    </body>
    
    protected void Button1_Click(object sender, EventArgs e)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "通知", "show()", true);
            }

    But i think if you trigger this from code behind, it will cause page postback, so can not solve the initial issue. I suggest you trigger it from page instead of code behind. 

    Best Regards,

    Eric Du 

    Friday, December 29, 2017 7:30 AM
  • User364663285 posted

    Hi,

    Can you please go to

    http://my-friend.co/UserMaintenance2/Default.aspx?userid=new&readonly=n

    by further putting "new“ to first field there, and you will see extra Panels (or Dialogues) being shown to the page. Why?

    How to ensure Panels/Dialogues (highlighted below) would not be displayed?

    https://app.box.com/s/jyi75no3kbxj7ev1879eh346o7mzsgv1

    Friday, January 12, 2018 4:15 AM