private async Task loadAuthors(serviceDAO service, int init, int currentPage) { List <Author> authors = await service.GetAllAuthors(); int fin = init + gvAuthors.PageSize; if (authors != null && fin > authors.Count) { fin = authors.Count; } gvAuthors.PageIndex = currentPage; gvAuthors.DataSource = authors; gvAuthors.DataBind(); for (int i = init; i < fin; i++) { List <Country> countries = await service.GetCountry(authors[i].IdCountry); if (countries != null && countries.Count > 0) { ((ImageButton)gvAuthors.Rows[i].Cells[3].Controls[0]).ImageUrl = "images/flags/" + countries[0].Code + ".png"; } ((ImageButton)gvAuthors.Rows[i].Cells[5].Controls[0]).Attributes.Add("OnClick", "if(!confirm('The entry will be deleted, are you sure?'))return false;"); } }
private async Task loadAuthors(serviceDAO service) { List <Author> authors = await service.GetAllAuthors(); ddlAuthor.DataSource = authors; ddlAuthor.DataValueField = "Id"; ddlAuthor.DataTextField = "Name"; ListItem selec = new ListItem("Select...", "0"); ddlAuthor.DataBind(); selec.Selected = true; ddlAuthor.Items.Insert(0, selec); }