I have a drop down that will open using example code from. https://jsfiddle.net/fz2sY/39/. However if I call the same function from code behind. ScriptManager.RegisterStartupScript(this, this.GetType(), "","runThis(dropdown);", true);
我有一个下拉列表,将使用示例代码打开。 https://jsfiddle.net/fz2sY/39/。但是,如果我从代码后面调用相同的函数。 ScriptManager.RegisterStartupScript(this,this.GetType(),“”,“runThis(dropdown);”,true);
The dropdown is inconsistant and opens sometimes but more often fails. Is there anything that can be changed in the code behind to make the function call more reliable?
下拉列表不一致并且有时会打开,但更多时候会失败。在后面的代码中是否可以更改任何内容以使函数调用更可靠?
1 个解决方案
#1
You need to call ShowDropdown
function after window load
您需要在窗口加载后调用ShowDropdown函数
ScriptManager.RegisterStartupScript(this, this.GetType(), "","window.onload = function(){ showDropdown(document.getElementById('dropdown'));}", true);
#1
You need to call ShowDropdown
function after window load
您需要在窗口加载后调用ShowDropdown函数
ScriptManager.RegisterStartupScript(this, this.GetType(), "","window.onload = function(){ showDropdown(document.getElementById('dropdown'));}", true);