ClientScript.RegisterClientScriptBlock不工作 [英] ClientScript.RegisterClientScriptBlock not working
问题描述
我在我的网页弹出这我想显示在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屋!