Daniel,
thanks for the advice. This solution works in case the DropDownList is
positioned free within a page.
However, In my case it is part of a Webgrid, as part of the NetAdvantage Web
Controls and within this configuration, it doesn't work.
I've attached a part of the HTML. Maybe you can find the origin of the
problem.
regards,
Oscar
<igtbl:ultrawebgrid id="UltraWebGrid1" style="Z-INDEX: 101; LEFT: 104px;
POSITION: absolute; TOP: 48px"
runat="server" Height="200px" Width="325px">
<DisplayLayout RowHeightDefault="20px" Version="4.00"
BorderCollapseDefault="Separate" Name="UltraWebGrid1">
<AddNewBox>
<Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray">
<BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px"
ColorLeft="White">
</BorderDetails>
</Style>
</AddNewBox>
<Pager>
<Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray">
<BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px"
ColorLeft="White">
</BorderDetails>
</Style>
</Pager>
<HeaderStyleDefault BorderStyle="Solid" BackColor="LightGray">
<BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px"
ColorLeft="White"></BorderDetails>
</HeaderStyleDefault>
<FrameStyle Width="325px" BorderWidth="1px" Font-Size="8pt"
Font-Names="Verdana" BorderStyle="Solid"
Height="200px"></FrameStyle>
<FooterStyleDefault BorderWidth="1px" BorderStyle="Solid"
BackColor="LightGray">
<BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px"
ColorLeft="White"></BorderDetails>
</FooterStyleDefault>
<ClientSideEvents
BeforeRowTemplateOpenHandler="UltraWebGrid1_Before RowTemplateOpenHandler"
AfterRowTemplateOpenHandler="UltraWebGrid1_AfterRo wTemplateOpenHandler"></ClientSideEvents>
<EditCellStyleDefault BorderWidth="0px"
BorderStyle="None"></EditCellStyleDefault>
<RowStyleDefault BorderWidth="1px" BorderColor="Gray"
BorderStyle="Solid">
<Padding Left="3px"></Padding>
<BorderDetails WidthLeft="0px" WidthTop="0px"></BorderDetails>
</RowStyleDefault>
</DisplayLayout>
<Bands>
<igtbl:UltraGridBand AllowUpdate="RowTemplateOnly" AllowAdd="Yes">
<Columns>
<igtbl:UltraGridColumn HeaderText="naam" Key="naam"
BaseColumnName="">
<Footer Key="naam"></Footer>
<Header Key="naam" Caption="naam"></Header>
</igtbl:UltraGridColumn>
<igtbl:UltraGridColumn HeaderText="kleur" Key="kleur"
Type="DropDownList" BaseColumnName="">
<ValueList>
<ValueListItems>
<igtbl:ValueListItem DataValue="geel" Key="geel"
DisplayText="geel"></igtbl:ValueListItem>
<igtbl:ValueListItem DataValue="rood" Key="rood"
DisplayText="rood"></igtbl:ValueListItem>
<igtbl:ValueListItem DataValue="blauw" Key="blauw"
DisplayText="blauw"></igtbl:ValueListItem>
</ValueListItems>
</ValueList>
<Footer Key="kleur"></Footer>
<Header Key="kleur" Caption="kleur"></Header>
</igtbl:UltraGridColumn>
</Columns>
<RowEditTemplate>
<DIV style="WIDTH: 256px; POSITION: relative; HEIGHT: 104px"
ms_positioning="GridLayout">
<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 16px" runat="server">naam</asp:Label>
<asp:Label id="Label2" style="Z-INDEX: 102; LEFT: 16px; POSITION:
absolute; TOP: 56px" runat="server">kleur</asp:Label>
<asp:TextBox id="TextBox1" style="Z-INDEX: 103; LEFT: 72px;
POSITION: absolute; TOP: 16px" runat="server"
columnKey="naam"></asp:TextBox>
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 104; LEFT:
72px; POSITION: absolute; TOP: 56px"
runat="server" Width="160px"
columnKey="kleur"></asp:DropDownList></DIV>
<BR>
<P align="center"><INPUT id="igtbl_reOkBtn" style="WIDTH: 50px"
onclick="igtbl_gRowEditButtonClick(event);"
type="button" value="OK"> <INPUT id="igtbl_reCancelBtn"
style="WIDTH: 50px" onclick="igtbl_gRowEditButtonClick(event);"
type="button" value="Cancel"></P>
</RowEditTemplate>
<RowTemplateStyle BorderColor="White" BorderStyle="Ridge"
BackColor="White">
<BorderDetails WidthLeft="3px" WidthTop="3px" WidthRight="3px"
WidthBottom="3px"></BorderDetails>
</RowTemplateStyle>
</igtbl:UltraGridBand>
</Bands>
</igtbl:ultrawebgrid>
"Daniel Walzenbach" <da***************@newsgroup.nospam> schreef in bericht
news:eo**************@TK2MSFTNGP12.phx.gbl...
Oscar,
try the following:
document.getElementById("DropDownList").options[0] = new Option("1990",
"1990");
Regards
---------------------------------------
Daniel Walzenbach
MCP
www.walzenbach.net
"Oscar" <ok*@xs4all.nl> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP10.phx.gbl...I want to add items to a dropdownlist control within a Javascript
eventhandler.
This is what I code :
var dd = document.getElementById("DropDownList1");
dd.Items.Add("1990");
dd.Items.Add("1991");
dd.Items.Add("1992");
however, it doesn't work.
What should I code instead ?