Page.ClientScript.RegisterStartupScript不显示的第二次信息 [英] Page.ClientScript.RegisterStartupScript not showing messages for 2nd time

查看:102
本文介绍了Page.ClientScript.RegisterStartupScript不显示的第二次信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Page.ClientScript.RegisterStartupScript 显示警报消息。它工作正常进行的第一条消息,但第二个消息显示习惯。虽然通过代码,而调试。

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.

下面是代码。这里只的 FiveDot文件上传成功显示的消息。

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.

推荐答案

使用不同类型或键登录第二个脚本为:

Use different type or key to register second script as:

一个客户端脚本通过它的键,它的类型标识。使用相同的密钥和类型
脚本被视为重复。只有一个$具有给定类型和密钥对B $ B脚本可以与网页注册。
试图注册已注册未
创建脚本的副本中的脚本。

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.

(从 MSDN 拍摄)

或只是两者连接起来脚本字符串。

or just concatenate both script string.

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

这篇关于Page.ClientScript.RegisterStartupScript不显示的第二次信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆