asp.net - Replace ASP .NET Eval when data binding with type-safe mechanism -


i'm looking forward refactor pieces of application , there many lines of code this:

<asp:templatefield headertext="name">     <itemtemplate>         <%# eval("employee.last_name")%>     </itemtemplate> </asp:templatefield> <asp:templatefield headertext="first name">     <itemtemplate>         <%# eval("employee.first_name")%>     </itemtemplate> </asp:templatefield> 

when refactoring property names (last_name, first_name) visual studio doesn't of course find these references properties in eval. now, when i'm refactoring replace type-safe + can spotted during compile time, in case in future need refactor once again. there way replace eval better mechanism?

eval evil (why long story), use ((employee)container.dataitem).last_name , ((employee)container.dataitem).first_name instead - it's faster, type safe, refactor friendly, avoids reflection, etc...


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -