protected void Page_Load(object sender, EventArgs e)
 {
     //if (!this.IsPostBack)
     //{
         MunicipioFacade facade = new MunicipioFacade();
         carregarGrid(facade);
     //}
 }
 protected void btnRemover_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtCodigo.Value))
     {
         MunicipioFacade facade = new MunicipioFacade();
         facade.MunicipioDeletar(int.Parse(txtCodigo.Value));
         carregarGrid(facade);
         limparCampos();
     }
 }
 protected void btnGravar_Click(object sender, EventArgs e)
 {
     MunicipioFacade facade = new MunicipioFacade();
     if (string.IsNullOrEmpty(txtCodigo.Value))
     {
         facade.MunicipioInserir(txtMunicipio.Text, txtUf.Text);
     }
     else
     {
         facade.MunicipioAlterar(int.Parse(txtCodigo.Value), txtMunicipio.Text, txtUf.Text);
     }
     carregarGrid(facade);
     limparCampos();
 }
 private void carregarGrid(MunicipioFacade facade)
 {
     GridViewMunicipio.DataSource = facade.Obter();
     GridViewMunicipio.DataBind();
 }