OnDataBinding vs Inline: pros, cons and overhead

后端 未结 5 967
深忆病人
深忆病人 2020-12-09 20:08

I thought I would ask this question to see why many examples and people prefer to use inline databinding in the aspx code vs implementing an OnDataBinding event when using W

5条回答
  •  甜味超标
    2020-12-09 21:07

    I much prefer the opposite. I prefer to keep my code-behind limited to procedural code, and keep all my declarative code in my Aspx page. In your example above, the literal is absolutely declarative and therefore (by my preference) would not belong in code-behind. Much more robust functionality generally goes in my code-behind, and I don't want my developers to be cluttered by having to sift through a bunch of initialization lines when trying to understand it.

提交回复
热议问题