1
As return a value of a column of the bank sql
for a textbox
in asp.net mvc
?
I created the textbox, 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 that ?
I have a class beyond the model I’m doing like 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;
}
First describe in what Model this value is. ASP.NET MVC does not access only one column of a record, but the whole record at once.
– Leonel Sanches da Silva
@Ciganomorrisonmendez, to taking a stick of this mvc pqp. rs I will put as I did so far in the question.
– AndreeH
Are you using Entity Framework? It is well out of the standard that you are doing.
– Leonel Sanches da Silva
No. Dude I don’t even know what I’m doing kkk. I’m completely lost in it. How nostalgic of webforms.
– AndreeH