Nicholas Murray
Nicholas Murray

Reputation: 13533

Edit text box in ASP.Net MVC application not working?

For reasons currently unknown, in a strongly typed partial view that handles editing which was created using the auto-scaffold for an "Edit" template, refuses to display any data in the textbox.

But, the test titletext string displays the relevent content.

<% using (Html.BeginForm()) {

try
{
%>

<fieldset>
<legend>Fields</legend>

<p>

<% 
string titletext = Model.Title.ToString();
%>

<%= titletext %>

<label for="Title">Title:</label>
<%= Html.TextBox("Title", Model.Title) %>
<%= Html.ValidationMessage("Title", "*") %>

</p>

Upvotes: 0

Views: 915

Answers (1)

twk
twk

Reputation: 3120

Make sure the text you put into the textbox doesn't contain html tags - try to html.encode your text.

In MVC 2 this is handled automagically.

Edit: Isn't the Model.Title property in conflict with Page-level Title variable?

Upvotes: 1

Related Questions