0

I'm using ASP.NET MVC 2 and I'm struggling to understand how can I use the Html.LabelFor helpet method.

Assuming I have a model:

public class Person
{
   public string lbmodelno { get; set; }}
}

In my view, if I write:

<%: Html.LabelFor(model => model.lbmodelno ) %>

in page loads im getting im getting

enter image description here

and in view source

enter image description here

but i dont need the default text "lbmodelno". in page load i need empty label. and it also overide value im getting from database. how to avoid this ?? im using mvc 2.0 i tried almost all ways but nothing help me.

How do I achieve that?

Thanks.

4

1 回答 1

0

向您的字段添加一个DisplayName属性lbmodelno,如下所示:

using System.ComponentModel;
public class Person
{
    [DisplayName("")]
    public string lbmodelno { get; set; }
}
于 2013-07-22T11:23:39.817 回答