Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <asp:DropDownList AppendDataBoundItems="true" ID="yourListId" runat="server">
- <asp:ListItem Text="Select something" Value="-1" />
- </asp:DropDownList>
- function addFirstItem(list, text, value)
- {
- var newOption = document.createElement("option");
- newOption.text = text;
- newOption.value = value;
- list.options.add(newOption);
- }
- addFirstItem(document.getElementById("yourListId"), "Select something", "-1");
- $("#yourListId option:first").before("<option value='-1'>Select something</option>");
- <asp:DropDownList AppendDataBoundItems="true" ID="yourListId" runat="server">
- <items>
- <asp:ListItem Text="Select something" Value="-1">--Select Something--</asp:ListItem>
- </items>
- </asp:DropDownList>
Add Comment
Please, Sign In to add comment