DropDownList overlapping WebDialogWindow
/// <summary>
/// Register javascript to hide select elements. Select elements overlap window in IE6
/// </summary>
protected void RegisterJavaScript()
{
//Creates function that displays select elements
if (!Page.ClientScript.IsClientScriptBlockRegistered("ShowSelect"))
{
string scrp = "<script>function showSelect(){ var dialog = $find('" + this.dialogWindow.ClientID + "');";
scrp += " var resultVar = dialog.get_windowState();if (resultVar == 3) {var elements = document.getElementsByTagName('select');";
scrp += "var i = 0; var dispType = 'inline'; while (i < elements.length) { elements[i].style.display = dispType;i++;}}}</script>";Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowSelect", scrp);
}
//Creates function that hides select elements
if (!Page.ClientScript.IsClientScriptBlockRegistered("HideSelect"))
{
string scrp = "<script>function hideSelect(){var elements = document.getElementsByTagName('select'); var i = 0;";
scrp += "while (i < elements.length) {elements[i].style.display = 'none';i++;}}</script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "HideSelect", scrp);
}
}
In the WebDialogWindow attributed I added the javascript functions to the ClientEvents tag.
<ClientEvents Initialize="hideSelect" WindowStateChanged="showSelect" />
/// Register javascript to hide select elements. Select elements overlap window in IE6
/// </summary>
protected void RegisterJavaScript()
{
//Creates function that displays select elements
if (!Page.ClientScript.IsClientScriptBlockRegistered("ShowSelect"))
{
string scrp = "<script>function showSelect(){ var dialog = $find('" + this.dialogWindow.ClientID + "');";
scrp += " var resultVar = dialog.get_windowState();if (resultVar == 3) {var elements = document.getElementsByTagName('select');";
scrp += "var i = 0; var dispType = 'inline'; while (i < elements.length) { elements[i].style.display = dispType;i++;}}}</script>";Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowSelect", scrp);
}
//Creates function that hides select elements
if (!Page.ClientScript.IsClientScriptBlockRegistered("HideSelect"))
{
string scrp = "<script>function hideSelect(){var elements = document.getElementsByTagName('select'); var i = 0;";
scrp += "while (i < elements.length) {elements[i].style.display = 'none';i++;}}</script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "HideSelect", scrp);
}
}
In the WebDialogWindow attributed I added the javascript functions to the ClientEvents tag.
<ClientEvents Initialize="hideSelect" WindowStateChanged="showSelect" />