开发者

How can we call functions in asp.net mvc?

开发者 https://www.devze.com 2023-03-23 22:10 出处:网络
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 i

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

精彩评论

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