Does Html.TextBox uses Request.Params instead of Model?

后端 未结 3 1002
时光取名叫无心
时光取名叫无心 2021-01-13 02:25

I have a simple test application:

Model:

public class Counter
{
    public int Count { get; set; }

    public Counter()
    {
        Count = 4;
           


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-13 03:04

    Html.TextBox has more parameters than one..first parameter is the name or id of input element, and the second one is the value...

    so write your textbox helper like this:

    <%= Html.TextBox("Count",Model.Count) %>
    

    cheers

提交回复
热议问题