In webforms, we do things like:
<%# CallSomefunctions(Eval("CustId")) %>
This function is present in asp.cs which can format our data and return appropriate string. How can we do the same in asp.net mvc since we do not have any concept of code开发者_C百科 behind?
The short answer is: You don't. Doing this violates the principles of MVC. The responsibility of your .aspx
page it to convert a model (some .NET object) into something you can present to the user and nothing else. Having it execute code violates this one-responsibility principle.
精彩评论