I have an ASP.NET related data dropdown that populates based on the contents of a text field. After it is filled in, I would like to automatically expand the drop-down list so that the user understands that they need to make a choice and do not need to click on the drop-down list to expand it. It seems that there is no property or method.
EDIT: After I tried the Ed B example, I was still stuck. My ddl's id is 'ctl00_ContentPlaceHolder9_ddlContact'. If I put the following in the onclick event of the button, it works fine, the drop-down menu expands beautifully:
document.getElementById('ctl00_ContentPlaceHolder9_ddlContact').size=10;
However, the following code in the Databound event for ddl shows a warning, but does not open the dropdown menu:
string script = "<SCRIPT LANGUAGE='JavaScript'> ";
script += "alert('expanding');document.getElementById('ctl00_ContentPlaceHolder9_ddlContact').size=10 </SCRIPT>";
ClientScript.RegisterClientScriptBlock(GetType(), "Dropdown", script);
source
share