Return value from bank to textbox Asp.net MVC

1

How do I return a value from a bank column sql to textbox in asp.net mvc ? I created the textbox, I created a property inside a class.

<label>
       @Html.DisplayNameFor(model => model.IRPJ) : 
       @Html.TextBox("txtIRPJ", Model.IRPJ , new {@class = "form-control form-control-custom", style="width:60px"})
</label>

How do I do this?

I have a class besides the model where I'm doing this:

 public BoletoModel IRPJ(string Tipo)
        {
            StringBuilder qryIRPS = new StringBuilder();
            qryIRPS.Append("Select Descricao1 ");
            qryIRPS.Append("from TiposNfsApp where ");
            qryIRPS.Append(" Tipo = '" + Tipo + "'");
            DadosNfsApp objDados = new DadosNfsApp();
            BoletoModel bm = new BoletoModel();
            DataTable dt = new DataTable();
            dt = objDados.RetornarDataSet(qryIRPS.ToString()).Tables[0];

            bm.IRPJ = dt.Rows[0]["Descricao1"].ToString().Trim();
            return bm;
        }
    
asked by anonymous 11.08.2015 / 20:31

1 answer

1

You've misused your View . Change to the following:

@model MeuProjeto.Models.BoletoModel // Preencha o nome da classe com o namespace. Aqui chutei um só pra você pegar a ideia.

<label>
       @Html.DisplayNameFor(model => model.IRPJ) : 
       @Html.TextBoxFor(model => modelIRPJ, new {@class = "form-control form-control-custom", style="width:60px"})
</label>
    
11.08.2015 / 21:45