TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkatesh Pettem
NA
343
9.6k
How to assign value to input field ?
Mar 17 2020 2:07 AM
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)
Reply
Answers (
3
)
How to move microsoft tools to top of the document
C# code -Compare 2 list and export the difference in excel