Child pages
  • Always naming database primary key the same
Skip to end of metadata
Go to start of metadata

I've recently looked template code, that has following piece in it:

<inp2:m_if check="worksheet_Field" name="SurveyId"> ... </inp2:m_if>

This code is located on item detail page and allows to check if page was accessed with existing item's ID.

I think there are 2 things about this code, that we can improve:

  • name database table primary keys just as Id (this would allow easier code re-use without need to rename too much stuff)
  • have special tag, like Exists or Loaded, that would just for that without need to use a database field name as input parameter.

Here is an example of transformed code: 

<inp2:m_if check="worksheet_Exists"> ... </inp2:m_if>
<inp2:m_if check="worksheet_Loaded"> ... </inp2:m_if>