G
Guest
I got stuck today on an annoying problem involving DataKeys, datasources,
and the GridView: I kept getting errors saying things to the effect of""Item
has already been added. Key in dictionary: 'Con_ContentID' Key being added:
'Con_ContentID'""
I figured I would post the solution I eventually found, because Googling
around on this revealed a number of puzzled people who had the same problem,
and few solutions. People kept pointing the puzzled legions to possibilities
involving manual entries to collections and the like. At least in my case,
this was not the problem.
You're most apt to run into this error with bigger, trickier apps involving
Multiviews, multiple application modes, and custom update methods. You will
reliably get the error above if you accidentally invoke DataBind() more than
once in an attempt to refresh the grid. Forcing the update is good, but make
sure you do it just once.
-KF
and the GridView: I kept getting errors saying things to the effect of""Item
has already been added. Key in dictionary: 'Con_ContentID' Key being added:
'Con_ContentID'""
I figured I would post the solution I eventually found, because Googling
around on this revealed a number of puzzled people who had the same problem,
and few solutions. People kept pointing the puzzled legions to possibilities
involving manual entries to collections and the like. At least in my case,
this was not the problem.
You're most apt to run into this error with bigger, trickier apps involving
Multiviews, multiple application modes, and custom update methods. You will
reliably get the error above if you accidentally invoke DataBind() more than
once in an attempt to refresh the grid. Forcing the update is good, but make
sure you do it just once.
-KF