Preserve DataGridViewRow.Tag property in databound DGV when sorting data
Is there a way to keep the tags from being nulled as soon as I sort the grid?
If not, is the Tag property actually useful for anything excep开发者_开发百科t non-databound usage?
Based on you last question, you are setting the Tag of DataGridViewRow objects. And they might very well be re-created during a Sort operation. Use reflector to make sure, but I would start looking for a workaround.
In general, the Tag property is a last resort.
You could use a Dictionary<object, object>
to couple your data to the dgvr.DataBoundItem
as key.
精彩评论