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:
- <form action="/action_page.php">
- <label for="fname">First name:</label>
- <input type="text" id="fname" name="fname"><br><br>
- <label for="lname">Last name:</label>
- <input type="text" id="lname" name="lname"><br><br>
- <input type="submit" value="Submit">
- </form>
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)