protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CadNoticia oCadNoticia = new CadNoticia(); lista = oCadNoticia.consultarTodos(); if (lista != null) { gdvCadNoticia.DataSource = lista; gdvCadNoticia.DataMember = "Tabela"; gdvCadNoticia.DataBind(); } } }
private void carregarTabelaDataSet() { CadNoticia objListarTodasNoticias = new CadNoticia(); DataSet dtListarTodosFilmes = objListarTodasNoticias.consultarTodos(); for (int linha = 0; linha <= dtListarTodosFilmes.Tables["Tabela"].Rows.Count - 1; linha++) { TableRow tRow = new TableRow(); tabelaNoticias.Rows.Add(tRow); for (int coluna = 0; coluna <= 3; coluna++) { TableCell tCell = new TableCell(); tCell.Text = Convert.ToString(dtListarTodosFilmes.Tables["Tabela"].Rows[linha][coluna]); tRow.Cells.Add(tCell); } } }