开发者

How to dynamically bind data to label in asp.net mvc

How to dynamically bind data to label in Asp.net MVC. I have table where i need to display all compnay name dayanamically. I did create a Model for compnay name.

code in model look like this,开发者_开发知识库

public class CompnayName
 {
     public string compnayName { get; set; }
     public string address { get; set; }

 }


Please first correct spelling of the class name ;-)

Your asp page needs to inherit from your model:

Inherits="System.Web.Mvc.ViewPage<namespace.CompanyName>"

Then uses LabeFor:

<%= Html.LabelFor(m => Model.companyName)%>

That should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜