开发者

How can we call functions in asp.net mvc?

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜