简体   繁体   中英

Best Practise for DataBinding on Markup vs Code Behind and its Impact on Performance

As per the question. Can someone advise, what are the best practices for binding data to UI.

Lets assume, I am working with a ASP.NET Web Form application, and there is a gridview Many code examples I have seen have the gridview bound to a datasource on the Markup and this could lead to issues when db is amended. On the other hand, if it was done code behind, then it would not be so problematic. But is there a trade off in terms of performance when making your datasource code behind? instead of binding it on the markup? I have seen a similar question as well Best practices for DataBinding in asp.net for maintainability . But that was in 2009, and alot of ideas, design and development patterns have changed and evolved since then.

My .NET webform experience is quite old, but if my memory serves well, data Data binding from code-behind is far more handy. It is more logical as well, as pure markup should mean structure. Naturally, when you use a framework, you can use templates in it, but the structure of the web form should not deal with data binding. This is my opinion only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM