My ASP.NET Controls don't display in <DIV> collapsible section?

liunx

Guest
Hi,

I can't get a collapsible section to work 100% with the < DIV > tags and a javascript handler (which is called on the "onchange" event for a < SELECT > control.

Anyway, I basically get it to expand/collapse the section when I make a selection from the triggering < SELECT >, but it only seems to display whitespace where there should be an asp:DropDownList, a couple of asp:Label's and asp:TextBoxes.

The funny thing is that the controls appear to be there, but aren't visible. I say this becaus when it is expanded, I can tab over to the "invisible" controls. Also, I took the raw HTML code that is rendered by this page and copied it over to a simple HTML page (along with the javascript function) and it works just fine when I open that file in IE!

Here's the relevant code snippets... Can anyone see what I may be doing wrong? Thanks in advance:

--------------------------------------------

<SCRIPT language="javascript">

function drpOwnOrRent_Handler() {

if(getObject("drpOwnOrRent")) {

var i = getObject("drpOwnOrRent").selectedIndex;
var selectedVal = getObject("drpOwnOrRent").options.value;

if(selectedVal == "Own") {
getObject("divInsSection").style.display = "block";
getObject("divLanSection").style.display = "none";
} else if(selectedVal == "Rent") {
getObject("divInsSection").style.display = "none";
getObject("divLanSection").style.display = "block";
} else {
getObject("divInsSection").style.display = "none";
getObject("divLanSection").style.display = "none";
}
}
}

</SCRIPT>

--------------------------------------------

<TR valign="top" align="center">
<TD class="TableCellLeft">
<ASP:LABEL id="lblOwnOrRent" runat="server" cssclass="BlueControlLabel">Do you own orrent yourhome?</ASP:LABEL>
</TD>
<TD class="TableCellLeft220">
<SELECT class="SmallDropDown" id="drpOwnOrRent" name="drpOwnOrRent" onchange="javascrip:drpOwnOrRent_Handler()">
<OPTION value="" selected>Select One</OPTION>
<OPTION value="Own">Own</OPTION>
<OPTION value="Rent">Rent</OPTION>
</SELECT>
</TD>
</TR>

--------------------------------------------

<DIV id="divInsSection" style="padding: 3px;" runat="server">
<TABLE cellpadding="5" width="100%" align="left" border="1">
<TR>
<TD><BR>
</TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft"><ASP:LABEL id="lblOKToHaveDog" runat="server" cssclass="BlueControlLabel">
Will your insurance allow the specific dog breed you are interested in?
</ASP:LABEL></TD>
<TD class="TableCellLeft220"><ASP:DROPDOWNLIST id="drpOKToHaveDog" runat="server" cssclass="SmallDropDown">
<ASP:LISTITEM selected="True" value="">SelectOne</ASP:LISTITEM>
<ASP:LISTITEM value="Y">Yes</ASP:LISTITEM>
<ASP:LISTITEM value="N">No</ASP:LISTITEM>
</ASP:DROPDOWNLIST></TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft"><ASP:LABEL id="lblInsuranceCo" runat="server" cssclass="BlueControlLabel">What isthename ofyour insurance company?</ASP:LABEL></TD>
<TD class="TableCellLeft220"><ASP:TEXTBOX id="txtInsuranceCo" runat="server" cssclass="DefaultTextBox"></ASP:TEXTBOX></TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft"><ASP:LABEL id="lblInsuranceAgent" runat="server" cssclass="BlueControlLabel">Whatis yourinsuranceagent'sname?</ASP:LABEL></TD>
<TD class="TableCellLeft220"><ASP:TEXTBOX id="txtInsuranceAgent" runat="server" cssclass="DefaultTextBox"></ASP:TEXTBOX></TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft"><ASP:LABEL id="lblInsurancePhone" runat="server" cssclass="BlueControlLabel">Whatis yourinsuranceagent'sphone?</ASP:LABEL></TD>
<TD class="TableCellLeft220"><ASP:TEXTBOX id="txtInsurancePhone" runat="server" cssclass="DefaultTextBox"></ASP:TEXTBOX></TD>
</TR>
<TR>
<TD><BR>
</TD>
</TR>
</TABLE>
</DIV>
<div id="divLanSection">
<TABLE cellpadding="5" width="100%" align="left" border="0">
<TR>
<TD><BR>
</TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft">
<ASP:LABEL id="lblLandlordOK" runat="server" cssclass="BlueControlLabel">
Will your landlord allow ownership of the specific dog breed you are interested in?
</ASP:LABEL>
</TD>
<TD class="TableCellLeft220"><ASP:DROPDOWNLIST id="drpLandlordOK" runat="server" cssclass="SmallDropDown">
<ASP:LISTITEM selected="True" value="">SelectOne</ASP:LISTITEM>
<ASP:LISTITEM value="Y">Yes</ASP:LISTITEM>
<ASP:LISTITEM value="N">No</ASP:LISTITEM>
</ASP:DROPDOWNLIST></TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft">
<ASP:LABEL id="lblLandlord" runat="server" cssclass="BlueControlLabel">Whatis yourlandlord's name?</ASP:LABEL></TD>
<TD class="TableCellLeft220">
<ASP:TEXTBOX id="txtLandlord" runat="server" cssclass="DefaultTextBox"></ASP:TEXTBOX></TD>
</TR>
<TR valign="top" align="center">
<TD class="TableCellLeft">
<ASP:LABEL id="lblLandlordPhone" runat="server" cssclass="BlueControlLabel">What isyour landlord'sphone?</ASP:LABEL></TD>
<TD class="TableCellLeft220">
<ASP:TEXTBOX id="txtLandlordPhone" runat="server" cssclass="DefaultTextBox"></ASP:TEXTBOX></TD>
</TR>
<TR>
<TD><BR>
</TD>
</TR>
</TABLE>
</div>Moved to .NET.
 
Back
Top