Has anyone found a way to change the selected row icon on a row by row basis? For example, rows 1-5 are noted as non-deletable and the rest are not. So if you select rows 1-5, I want the icon on the left to be a lock, but if it is any other row, I want it to be an arrow.
I have been able to meet my need by creating a templated column with an image control in it, but I was wondering if there is an easier way to set that image at the row level.
Hello,
You should be able to access the RowSelectorStyle of each row:
this.UltraWebGrid1.Rows[0].RowSelectorStyle
You can either set a CSS style or apply an image to the specific RowSelector at that point to get the result you are looking for.
This would work if I wanted to change the BackgroundImage, but the arrow that appears by default is not a background image.
To change the "arrow" image, you need to set this.UltraWebGrid1.DisplayLayout.Images.CurrentRowImage, but this is at the grid level.
It would be nice have this.UltraWebGrid1.Rows[0].SelectorImage which would overwrite the grid's CurrentRowImage.
This is true, the row selector image is set dynamically as you select a row. You have a couple of options: set a css style for the rows you would like a custom image for and clear the dynamically set image when a row is selected, or when a row is selected, set the image source.
Either way, the event you need to handle is the AfterRowActivate event and obtain the row selector cell. You can do this using the following code:
var row = igtbl_getRowById(rowId);
// Either clear or set to a new source
}
The rowId allows you to choose which rows need the image.
Thanks for the response, I will give it a try.