private void btnAuthor_Click(object sender, EventArgs e) { AuthorControl control = new AuthorControl(); CleanControls(); pnlControls.Controls.Add(control); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <int, string> authorsDictionary = new AuthorControl().getAuthor(); ListItem item; if (!Page.IsPostBack) { foreach (int key in authorsDictionary.Keys) { item = new ListItem(); item.Value = key.ToString(); item.Text = authorsDictionary[key]; DropDownList_author.Items.Add(item); } } //DropDownList_author.DataSource = new AuthorControl().getAuthor(); }