How can I dynamically change the contained edit control in a grid cell from on think (dropdown, for example) to another (text edit)?
Seems I need to tell the UI the cell is 'dirty' and invoke a repaint event?
Thanks,
Douglas
Hi Douglas,
There's not really enough information here for me to give you a good answer. Why are you changing the editor in the cell? What is it based on? Whatever event(s) are you using?
Typically, this is something you would do in the InitializeRow event. In that event, you would not have to refresh anything.
In AfterEnterEditMode I want to change the cell from a dropdown to an editable textbox or repopulate the dropdown with different data -- depending on the contents of an adjacent column.
I don't think this will work in AfterEnterEditMode. The cell has already entered edit mode and displayed whatever editor it already had by that point. Even if that worked, it would cause an infinite loop as the cell would have to exit edit mode on the current editor and re-entered edit mode on the new one.
Why did you choose AfterEnterEditMode?
Typically, if you want to change the editor in a cell, you would base it on the value of some other cell in the row and so you would use the InitializeRow event.
Can I get a quick sample demonstrating this?
I don't have any samples readily available, although there may be some samples or sample code posted here on the forums, already.
Which part of this is giving you trouble? There's really not much to it.
You hand InitializeRow, examine e.Row and determine which editor you want to use and assign it to the cell.
I think I found what I need. Thanks.