Tag Archives: automatic databind

GridView problem – Item has already been added. Key in dictionary: ‘Timestamp’ Key being added: ‘Timestamp’

In general ASP.net, this can be caused by calling DataBind() more than once on a databound control. Also be aware that this is influenced by automatic databind being on too.

Relating this to Sitecore CMS, you should be aware that Sitecore ships with the following line in web.config:

<!– AUTOMATIC DATA BIND
Indicates if the data bind function is run automatically
–>
<
setting name=AutomaticDataBind value=false />

This means that you will need to either call Databind whenever you need it, or you can simply set this value to true.  This AutomaticDataBind setting will also cause problems with other types of databound controls, such as templated controls. It’s generally simpler to set it to ‘true’..