Thursday, March 22, 2012

Simple dropdownlist question

Hello,

I have this control:
<asp:DropDownList id="cmbDivisions"
OnSelectedIndexChanged="setDefault('cmbDivisions');" cssclass="size8"
runat="server"/>

When I try to build the page in VisStudio2005, I get this error:
'setDefault' is not a member of 'ASP.index_aspx

setDefault is defined previously in the file:
function setDefault(id) {
var div, tmp;
<snip>
}
Thanks for any advice on what I'm doing wrong.Have you tried moving the script to inside the form tag?

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-----------------

"Schemer" <cbne2001@.hotmail.comwrote in message
news:%23LzXX1FxGHA.3436@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Hello,
>
I have this control:
<asp:DropDownList id="cmbDivisions"
OnSelectedIndexChanged="setDefault('cmbDivisions');" cssclass="size8"
runat="server"/>
>
When I try to build the page in VisStudio2005, I get this error:
'setDefault' is not a member of 'ASP.index_aspx
>
setDefault is defined previously in the file:
function setDefault(id) {
var div, tmp;
<snip>
}
Thanks for any advice on what I'm doing wrong.
>


Thanks for the suggestion.
Here's the beginning of the <form>:

<body onload="init();">
<form id="frmHome" runat="server">
<script language="javascript">
<asp:Literal id="litConf" runat="server"/>

function init() : void {
var tmp;
' snip
}

function setDefault(id:string) : void {
var div, tmp;

' snip
}
</script>

<lb:header id="ucHeader" runat="server"/>

<!-- begin layout -->

I get the same error when trying to build.
Does this attribute look correct:
OnSelectedIndexChanged="setDefault('cmbDivisions');"

Thanks for your help.

Quote:

Originally Posted by

Have you tried moving the script to inside the form tag?

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-----------------

"Schemer" <cbne2001@.hotmail.comwrote in message
news:%23LzXX1FxGHA.3436@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>Hello,
>>
>I have this control:
><asp:DropDownList id="cmbDivisions"
>OnSelectedIndexChanged="setDefault('cmbDivisions');" cssclass="size8"
>runat="server"/>
>>
>When I try to build the page in VisStudio2005, I get this error:
>'setDefault' is not a member of 'ASP.index_aspx
>>
>setDefault is defined previously in the file:
>function setDefault(id) {
>var div, tmp;
><snip>
>}
>Thanks for any advice on what I'm doing wrong.
>


>


Is it possible there is an interaction with another element?
Here's more context:
<td class="layoutBottom">
<lb:ContentBox id="boxBotLeft" Title="Default Division"
SmallBox="true" runat="server">
Set your default division and conference:<br/>
<asp:DropDownList id="cmbDivisions" OnSelectedIndexChanged
="setDefault('cmbDivisions');" cssclass="size8" runat="server"/>
<br/>
<select id="cmbConferences" class="size8"
onchange="setDefault('cmbConferences');">
</select>
</lb:ContentBox>
</td>

TIA.

Quote:

Originally Posted by

I have this control:
<asp:DropDownList id="cmbDivisions"
OnSelectedIndexChanged="setDefault('cmbDivisions');" cssclass="size8"
runat="server"/>
>
When I try to build the page in VisStudio2005, I get this error:
'setDefault' is not a member of 'ASP.index_aspx
>
setDefault is defined previously in the file:
function setDefault(id) {
var div, tmp;
<snip>
}

0 comments:

Post a Comment