从code后面的ASP下拉开放 [英] ASP open dropdown from code behind
问题描述
我有一个下拉,将打开使用例如code而来。 https://jsfiddle.net/fz2sY/39/ 。
但是,如果我的背后叫从code相同的功能。
ScriptManager.RegisterStartupScript(这一点,this.GetType(),,runThis(下拉);,真);
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);
在下拉列表是不一致的,有时打开,但更多的时候失败。
有什么可以在code被改变的背后,使函数调用更可靠?
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?
推荐答案
您需要调用 ShowDropdown
后功能窗口负载
You need to call ShowDropdown
function after window load
ScriptManager.RegisterStartupScript(this, this.GetType(), "","window.onload = function(){ showDropdown(document.getElementById('dropdown'));}", true);
这篇关于从code后面的ASP下拉开放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!