First write onLoad using the addItems function in the drop-down list declaring the .aspx tag, for example:
then create the addItems function in the cs file.
<asp:DropDownList ID="DropDownList1" runat="server" OnLoad="addDeleteItems" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
protected void addItems(object sender, System.EventArgs e)
{
DropDownList ddl = (DropDownList)sender;
ListItem newItem = new ListItem("rose", "i");
ddl.Items.Add(newItem);
}
source
share