Solved

!!ASP.NET ListBoxs appearing on top of Panels!!

Posted on 2004-08-18
11
149 Views
Last Modified: 2010-04-07
Guys,

I am currenly building a page that displays a summary of information in a panel over the top of a page that has listboxs on it.  As is typical with DropDownLists, they appear ontop of the panel.  Is there any way to stop this?  This problem has come up before and i desperately require a solution.  

Thanks guys,

Neil
0
Comment
Question by:SlammingRumJoseph
  • 3
  • 2
  • 2
  • +1
11 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 168 total points
ID: 11830430
have you tried setting the listbox to visible = false?

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11830445
example:

Me.MyDropDownList.Visible = False

0
 

Author Comment

by:SlammingRumJoseph
ID: 11830452
i have thought of that but i was hoping to avoid that solutions if possible.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 4

Assisted Solution

by:hamood
hamood earned 166 total points
ID: 11830460
althought situation is not clear but i think you have to add tables in the code for adjusting dropdown list posistions

here is sample code

<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 16px; WIDTH: 424px; POSITION: absolute; TOP: 8px; HEIGHT: 27px"
                        cellSpacing="1" cellPadding="1" width="424" border="1">
<TR>
<TD>
<asp:DropDownList id="DropDownList1" runat="server"></asp:DropDownList></TD>
<TD>
<asp:DropDownList id="DropDownList2" runat="server"></asp:DropDownList></TD>
<TD>
<asp:DropDownList id="DropDownList3" runat="server"></asp:DropDownList></TD>
</TR>
</TABLE>

hamood
0
 
LVL 8

Assisted Solution

by:shovavnik
shovavnik earned 166 total points
ID: 11833442
There is no way to avoid that behavior for dropdownlists.  dd lists are actually parsed differently by the browser than all other controls because of their unique behavior.  The only solutions you have are:

1. Hide you dropdownlists when they get in the way.  Don't hide them on the server-side; use client side javascript to hide them:

document.all.mydropdownlist.style.display = 'none';

2. Create your own dropdownlists using dhtml and javascript, but not real dropdownlists.

<div id="mydropdownlist">
  <table>
  <tr id="row1" onclick="doDropDownAction(1)"><td>First List Item</td></tr>
  </table>
</div>

and javascript:
function doDropDownAction(rowIndex) {
  alert( rowIndex );
}

A similar solution can be made with server-side controls if you need to be able to bind to the control.  You can also bind your table to an xml data island that can contain a list of commands if you need a dynamic client-side dropdownlist.
0
 
LVL 4

Expert Comment

by:hamood
ID: 11841503
On thing that i would like to mention here is that dd lists, activex controls and applets have Z-order higher than all controls. so they will always render on the top of other controls.
In our applciation we have some menus and when user is selecting any item from menu and page under this menu has some dd list this dd list appears on top of menu.
One solution that we are using here is hiding the drop down list in the page when user is selecting any item from menu and any dd list is there on the page. It will hide only those dd list which are causing problems.

Here is the javascript code that we are using to hide the dd list
set the id of <td> having any drop down list to "drop" and call the function makeTheImageLayers(3) on load event of the body tag. Count number of ddlists and pass this number to makeTheImageLayers function.

var Temp = new Array();
      var count=0;
      var nDrops=0; // it will contain the total number of drop downs
      var Dhtml_frm;
      var D_htmlTable = new Array();
      var D_htmlTextBox = new Array();
      var hiddenCombos =  new Array();
      var hc_Count=0;

//call this function in the <bodg> under the onload event
      function makeTheImageLayers(nD)
      {
            //setting out the references
            Dhtml_frm = document.forms[0];
            imgHiddenCombos();
            //alert(Dhtml_frm)
            var styleWidth = 155;
            nDrops=nD;
            var i=0;
            for(i=0; i<nD; i++)
            {
                  var D_html="";
                  D_html = "<TABLE id='D_htmlTable_nf' cellSpacing='0' cellPadding='0' width='300' border='0' style='WIDTH:" + styleWidth + "px;height:22px;display:none'>"
                  D_html = D_html + "<TR>"
                  D_html = D_html + "<TD style='WIDTH:" + (styleWidth-16) + "px;height:22px;'><input type='text' id='D_htmlTextBox_nf' style='width:" + (styleWidth-16) + "px;height:22px;BORDER-RIGHT-STYLE: none;PADDING-LEFT: 3px;' name='t' value=''></TD>"
                  D_html = D_html + "<TD style='WIDTH:16px';height:22px;><IMG alt='' src='../images/arrow.gif'></TD>"
                  //D_html = D_html + "<TD style='WIDTH:16px;height:22px;'><input type=Button value='&#9660;' name=bbb style='WIDTH:16px;height:21px;font-size:7pt;BORDER-RIGHT: thin outset; BORDER-TOP: groove; BORDER-BOTTOM: thin outset; BORDER-LEFT-STYLE: none;'></TD>"
                  D_html = D_html + "</TR>"
                  D_html = D_html + "</TABLE>"
                  if (nD < 2)
                        Drop.innerHTML = Drop.innerHTML + D_html;
                  else
                        Drop[i].innerHTML = Drop[i].innerHTML + D_html;

                  if(i < 1){
                        D_htmlTable[i]=D_htmlTable_nf
                        D_htmlTextBox[i] = Dhtml_frm.D_htmlTextBox_nf
                  }
                  else{
                        D_htmlTable[i]=D_htmlTable_nf[i];
                        D_htmlTextBox[i] = Dhtml_frm.D_htmlTextBox_nf[i];
                  }
            }
      }



      
      function searchHiddenCombos(cmbName)
      {
            var hi=0;
            for(hi=0; hi<hc_Count; hi++)
            {
                  if ( hiddenCombos[hi] == cmbName )
                  {
                        //alert(hiddenCombos[hi])
                        return true;
                  }
            }
            return false;
      }
      function imgHiddenCombos()      
      {
            var ci=0;
            hc_Count = 0;
            for(ci=0; ci<Dhtml_frm.length; ci++)
            {      
                  if (Dhtml_frm.elements[ci].style.display == "none" || Dhtml_frm.elements[ci].style.visibility == "hidden")
                  {
//                        if(hc_bit==false)
//                        {
                              hiddenCombos[hc_Count] = Dhtml_frm.elements[ci].name;
                              //alert(hiddenCombos[hc_Count])
                              hc_Count++;
//                        }
                  }
            }
      }


Let me know if i could solve your problem

Hamood
0
 
LVL 8

Expert Comment

by:shovavnik
ID: 12083794
Solutions have been offered and the user hasn't responded.  I recommend splitting the points.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12083817
I concur...Aeros
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Data is not showing from images 15 47
Gridview selected row 9 44
ASP.net show message while code is running 3 17
How can my static class become undefined?? 8 47
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question