ClientScript.RegisterClientScriptBlock不工作 [英] ClientScript.RegisterClientScriptBlock not working

查看:289
本文介绍了ClientScript.RegisterClientScriptBlock不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网页弹出这我想显示在DropDownList中选定的索引更改事件。
这里是寄存器声明

I have a popup in my page which I am trying to show on dropdownlist selected index changed event. Here is register statement

ClientScript.RegisterClientScriptBlock(GetType(),"id", "ShowApplicationPopUp()",true);

下面是我的javascript函数

Here is my javascript function

function ShowApplicationPopUp() {

    $('#NewCustomerMask').show("slow");
    $('#NewCustomerApplicationPopUp').show("slow");

}

; 语句无:

我的两个div的最初使用显示隐藏。
问题是,当我的DropDownList改变时弹出是没有看到在all.I试图把警报语句来检查函数被调用,并警告语句fired.Any想法,我在做什么错。
任何建议都欢迎。
谢谢你。

Both of my divs are initially hidden by using display:none; statement. The problem is when my dropdownlist is changed the popup is not seen at all.I tried putting an alert statement to check if the function is called , and the alert statement is fired.Any ideas as to what I am doing wrong. Any suggestions are welcome. Thanks.

推荐答案

当您使用的RegisterClientScriptBlock JavaScript的code在页​​面年初插入,所以它会加载的内容之前运行。

When you use RegisterClientScriptBlock the Javascript code is inserted early in the page, so it will run before the elements are loaded.

使用的RegisterStartupScript 来代替,哪个地方code。在表单的结尾。

Use RegisterStartupScript instead, which places the code at the end of the form.

这篇关于ClientScript.RegisterClientScriptBlock不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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