Page.ClientScript.RegisterStartupScript not showing messages for 2nd time

后端 未结 3 1993
清酒与你
清酒与你 2021-02-14 01:38

I\'m using Page.ClientScript.RegisterStartupScript for displaying alert messages. it works fine for the first message, however second message wont display. Though i

3条回答
  •  面向向阳花
    2021-02-14 02:17

    Use different type or key to register second script as:

    A client script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. Only one script with a given type and key pair can be registered with the page. Attempting to register a script that is already registered does not create a duplicate of the script.

    (taken from MSDN)

    or just concatenate both script string.

    Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('FiveDot File uploaded successfully'); alert('TwoDot File uploaded successfully');", true);
    

提交回复
热议问题