Thursday 7 February 2013

Method in MVC Razor View


 Use @functions  then create inside  of the @functions
I give just samll sample code.

Working process for when razor view in @Htmllable  run time call the GetSomeString() methode. This method return just concatenation in tow string value.

So we can  asign any method in Razor view


  
@functions{
public string GetSomeString()
{
return MakeMeChangeMyJob.Strings.Resume.PadRight(100) + " (min 100 characters )";//Add space and some tect

}
}

@Html.Label(GetSomeString(), new { @class = Model.AccountType == MakeMeChangeMyJob.Models.AccountType.User ? 

"required" : "none" })


So we can  asign any method in Razor view.More details is below



http://weblogs.asp.net/scottgu/archive/2011/05/12/asp-net-mvc-3-and-the-helper-syntax-within-razor.aspx


http://dotnetslackers.com/articles/aspnet/Razor-Functions-and-Helpers.aspx


No comments:

Post a Comment

If any doubt?then please comment in my post

How to reduce angular CLI build time

 Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...