How to pass Variable value in @html.textboxfor using asp.net mvc
Below in the query:
@{
var SbTotal =5;
}
@Html.TextBoxFor(item => item.Total, new { id = "materialCostInput" + SbTotal })
@(OutOfhund + OutOfhundBeh + OutOfhundFun)
How to pass Variable value in @html.textboxfor using asp.net mvc
Below in the query:
@{
var SbTotal =5;
}
@Html.TextBoxFor(item => item.Total, new { id = "materialCostInput" + SbTotal })
@(OutOfhund + OutOfhundBeh + OutOfhundFun)
Know the answer? Post it. Somebody with the same question will find it here.


Hi
Simply try this
@Html.TextBoxFor(item => item.Total, new { @Value =SbTotal })
Try this -
@Html.TextBoxFor(item => item.Totel, new { @Value =SbTotal })
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Jun 11, 2021, 8:04 AM EDT
Rijwan AnsariRank #82 · 24.2K reputationPosted Jun 11, 2021, 8:02 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 11, 2021, 5:55 AM EDT