Hello,
Im working on html content to disply data in mvc view binding data from model class, my requirement is to set values to input fields to html content from c#.
i want final content should come up with html content and values from model.
EXAMPLE:
- ="fname">First name:
- "text" id="fname" name="fname">
- ="lname">Last name:
- "text" id="lname" name="lname">
- "submit" value="Submit">
This is my html content which is coming from text file. i've data in my model, i.e,
- public class EmployeeModel
- {
- public string fname { get; set; } = "CSharp";
- public string lname { get; set; } = "Corner";
- }
In View :
@Html.Raw(ViewBag.htmlContent)


Vishvjit ShindeRank #3,119 · 459 reputationPosted Mar 16, 2020, 11:29 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 17, 2020, 7:03 AM EDT
Sagar MaldeRank #2,097 · 684 reputationPosted Mar 18, 2020, 3:17 AM EDT