ClientScript在代码隐藏中不起作用

时间:2017-03-09 22:28:28

标签: javascript asp.net vb.net

我创建了脚本以在后面的代码中调用javascript。但它有一个错误。我没弄清楚出了什么问题。有人会指出我。感谢。

有我的代码:

Dim strScript As String = "<script language=javascript>alert('test/page1.aspx?loctionFolder=
                      Server.HtmlEncode(hdFolderLocation.Value) & "');return false; </script>"

            If Not ClientScript.IsStartupScriptRegistered(Me.GetType(), "download") Then
                Page.ClientScript.RegisterStartupScript(Me.GetType(), "download", strScript, True)
            End If

2 个答案:

答案 0 :(得分:0)

您在--Example of converting to OEX/columnar formats DROP TABLE site_sensor_data_raw; CREATE EXTERNAL TABLE site_sensor_data_raw ( count int, dateTime8601 timestamp ) PARTITIONED BY(year int, month int, day int, hour int) ROW FORMAT serde 'org.apache.hive.hcatalog.data.JsonSerDe' with serdeproperties ( 'ignore.malformed.json' = 'true', "timestamp.formats"="yyyy-MM-dd'T'HH:mm:ss.SSS'Z',millis" ) LOCATION 's3://bucket.me.com/raw/all-sites/'; ALTER TABLE site_sensor_data_raw ADD PARTITION (year='2017',month='03',day='09',hour='15') location 's3://bucket.me.com/raw/all-sites/2017/03/09/15'; ALTER TABLE site_sensor_data_raw ADD PARTITION (year='2017',month='03',day='09',hour='16') location 's3://bucket.me.com/raw/all-sites/2017/03/09/16'; ALTER TABLE site_sensor_data_raw ADD PARTITION (year='2017',month='03',day='09',hour='17') location 's3://bucket.me.com/raw/all-sites/2017/03/09/17'; DROP TABLE to_orc; CREATE EXTERNAL TABLE to_orc ( count int, dateTime8601 timestamp ) STORED AS ORC LOCATION 's3://bucket.me.com/orc' TBLPROPERTIES ("orc.compress"="ZLIB"); INSERT OVERWRITE TABLE to_orc SELECT count,dateTime8601 FROM site_sensor_data_raw where year=2017 AND month=03 AND day=09 AND hour=15;

之前错过了双引号和连词
Server.HtmlEncode(hdFolderLocation.Value)

答案 1 :(得分:0)

RegisterStartupScript Method的最后一个参数是 addScriptTags

在您的情况下,您将其设置为strScript, True),因此 不需要脚本标记

Dim strScript As String = "alert('test/page1.aspx?loctionFolder=" & 
   Server.HtmlEncode(hdFolderLocation.Value) & "');return false;";