I'm using Page.ClientScript.RegisterStartupScript
for displaying alert messages. it works fine for the first message, however second message wont display. Though it passes through the code while debugging.
Below is the code. Here only FiveDot File uploaded successfully message is displayed.
Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('FiveDot File uploaded successfully');", true);
Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('TwoDot File uploaded successfully');", true);
I've to show multiple alert messages in the webpage based on certain conditions.
ClientScript. RegisterStartupScript for displaying alert messages. it works fine for the first message, however second message wont display. Though it passes through the code while debugging.
RegisterStartupScript(Control, Type, String, String, Boolean) Registers a startup script block for a control that is inside an UpdatePanel by using the ScriptManager control, and adds the script block to the page.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With