Ejemplo n.º 1
0
    protected void btnSalvarClick(object sender, EventArgs e)
    {
        Noticia noticia = new Noticia();
        string  retorno = noticia.salvar(
            int.Parse(campoID.Value),
            txtNotTitulo.Text.ToString(),
            txtNotTexto.Text.ToString(),
            DateTime.Parse(txtNotData.SelectedDate.ToString()),
            txtNotImagem.Text.ToString(),
            new Categoria(int.Parse(txtCatId.SelectedValue))
            );

        if (string.IsNullOrEmpty(retorno))
        {
            mostrarMensagem("Registro salvo com sucesso.");
            atualizarCampos(codigoSelecionado());
            habilitarCampos(false);

            ObjectDataSource1.DataBind();
            GridView1.DataBind();
        }
        else
        {
            mostrarMensagem(retorno);
        }
    }