[RESOLVED] add items in my dropdownlist???
asp.net code
<asp:DropDownList id="infodrop" runat="server">
<asp:ListItem Value="TestData1">TestData1</asp:ListItem>
<asp:ListItem Value="TestData2">TestData2</asp:ListItem>
</asp:DropDownList>
Q: Why in my sample.aspx html dont have <asp:ListItem???
* I have a infodrop and i wanted to add an items like TestData1,TestData2 and TestData3.
Re: add items in my dropdownlist???
Try this out, the text displayed and the value returned will be the same.
VB Code:
<asp: DropDownList
ID="infoDrop"
Runat="server">
<asp:ListItem Text="TestData1" />
<asp:ListItem Text="TestData2" />
<asp:ListItem Text="TestData3" />
</asp: DropDownList>
If you want a different value to be returned you have to assign your value as well:
VB Code:
<asp: DropDownList
ID="infoDrop"
Runat="server">
<asp:ListItem Text="TestData1" Vaule="data1" />
<asp:ListItem Text="TestData2" Value="data2"/>
<asp:ListItem Text="TestData3" VAule="data3"/>
</asp: DropDownList>
Re: add items in my dropdownlist???
Make sure you don't just copy and paste Tinbeard's code and wonder why it's not working. 'Value' is spelled incorrectly on two of the three lines on which it appears.
Re: add items in my dropdownlist???
Re: add items in my dropdownlist???
note to self....... don't reply to threads when tired ;)
sorry for not being vigilent.