Hi, I have a ultraGridRowEditTemplate that is assigned to a wingrid band
e.g. ultraGridBand5.RowEditTemplate = this.ultraGridRowEditTemplate1;
However, once I hide or disable the wingrid and rebind it again via a ultracombo, I have lost the RowEditTemplate from the grid. Of course, exiting and then reloading the form will sort this (by firing the InitializeComponent() method), but I really don't want to have to do this. Is there anyway to assign the ultraGridRowEditTemplate back to the wingrid when the wingrid is shown again?ThanksChris
Hi,
There's no reason why hiding or disabling the grid should have any effect on the RowEditTemplate. I am assuming that you mean that you are hiding then showing the grid again. Obviously, the grid will never show the RowEditTemplate while the grid is disabled or invisible.
Setting the grid's DataSource will lose your entire layout, including the RowEditTemplate. The band will be destroyed and a new band created. So this is why it's a good idea to set the RowEditTemplate inside the InitializeLayout event so that it will get re-applied.
I'm not really sure what you are asking, though. Your question appears to be: how do you assign the RowEditTemplate back to the grid. But you already know how to do that - you posted the code right here. You set the RowEditTemplate propererty on the band.
grid.DisplayLayout.Bands[myBand].RowEditTemplate = this.ultraGridRowEditTemplate1;
Thank you Mike, I was obviously confused with the InitaliseComponent function doing the work for me on form load. Also regarding the RowEditTemplate object, is there a way I can format the text before it get painted into the UltraGridCellProxy object that is within the ultraGridRowEditTemplate?For example, The text appears left aligned in the wingrid cell, and when the user wants to edit the text of this cell, it appears middle aligned in the cell proxy? CheersChris