コード例 #1
0
    protected void HabilitaCampos(bool habilita)
    {
        txtDescricao.Enabled = habilita;
        txtValor.Enabled     = habilita;
        txtQtde.Enabled      = habilita;
        btnInserir.Enabled   = !habilita;

        if (Convert.ToInt32(lblId.Text) == 0)
        {
            btnAlterar.Enabled  = habilita;
            btnRemover.Enabled  = habilita;
            btnCancelar.Enabled = habilita;
            btnSalvar.Enabled   = habilita;
            txtDescricao.Text   = "";
            txtValor.Text       = "";
        }
        else
        {
            btnAlterar.Enabled  = !habilita;
            btnRemover.Enabled  = !habilita;
            btnCancelar.Enabled = habilita;
            btnSalvar.Enabled   = habilita;
        }

        LOCAR.Camadas.BLL.Categoria bllCategoria = new LOCAR.Camadas.BLL.Categoria();
        grvCategorias.DataSource = bllCategoria.Select();
        grvCategorias.DataBind();
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LOCAR.Camadas.BLL.Categoria bllCateg = new LOCAR.Camadas.BLL.Categoria();

            ddlCategorias.DataTextField  = "Descricao";
            ddlCategorias.DataValueField = "IdCategoria";
            ddlCategorias.DataSource     = bllCateg.Select();
            ddlCategorias.DataBind();

            Cache["OP"]       = "S";
            lblId.Text        = "0";
            lblCategoria.Text = "0";
            HabilitaCampos(false);
        }
    }