Code issue

Peter_1985 2,736 Reputation points
2021-12-17T09:10:55.257+00:00

Hi,
How to ensure 2nd button below is not there
158537-3g.png
to this code?

Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "ShowMessage('货币简称错误。');", true);

Developer technologies ASP.NET Other
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 30,186 Reputation points Microsoft External Staff
    2021-12-20T05:46:47.1+00:00

    Hi @Peter_1985 ,
    You need to provide the ShowMessage() JavaScript code so that we can help you solve the problem.
    You can look at the usage of RegisterStartupScript Method https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.clientscriptmanager.registerstartupscript?view=netframework-4.8
    You can refer to the demo:
    158902-text.png
    Code behind:

    protected void Button1_Click(object sender, EventArgs e)  
    {  
            Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "ShowMessage()", true);  
    }  
    

    158847-demo1.gif
    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2021-12-17T21:15:26.207+00:00

    change the ShowMessage() function to allow this.


  2. AgaveJoe 30,126 Reputation points
    2021-12-18T13:22:26.403+00:00

    My best guess is you copied the Bootstrap modal sample code. Simply remove the HTML.

    <button type="button" class="btn btn-primary">Save changes</button>
    

    If this does not answer your question then you'll need to clarify how you expect the logic to work and provide sample code.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.