public async void setTableProducts() { try { List <Product> products = await DefaultController.GetProducts(); DataTable tableProducts = Utils.Util.ConvertToDataTable <Product>(products); GridView1.DataSource = tableProducts; GridView1.DataBind(); } catch (Exception ex) { string script = @"<script type='text/javascript'> alert('{0}'); </script>"; script = string.Format(script, ex.Message); ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } }