Hi,
We're using version 10.2 for now. I have a grid where there is a "status" column. Is it possible to display a button in a cell based on the status? If I set the column's style to EditButton, then it appears for every cell in the column when the display style is set to Always. I only want the button to appear for rows that have a certain status. Would I need to create a separate unbound column to do this? Also, can I display the button in a cell where the column is set to show images?
thanks
Mario
Hi Mike,
Thanks for the sample. That helps.
Hi Mario,
mpiccoli said:In order to make the button always show, do I still set the ButtonDisplayStyle for the column?
Yes.
mpiccoli said:Also, is there a way to add text to the button itself?
The EditButton Style doesn't support text, only an image. If you want text in the button, you have to use an Editor instead of the Style property. I am attaching a small sample here that demonstrates how to do it.
I looked at the cell level and didn't see the Style property, but I do see it now. Come to think of it, I was looking for the ButtonDisplayStyle property and didn't see that at the cell level. In order to make the button always show, do I still set the ButtonDisplayStyle for the column? Also, is there a way to add text to the button itself?
I did verify that the button shows up on a cell that contains only an image.
Thanks
Hello,
You can accomplish this by setting the Style property on the specific cells in InitializeRow. Take a look at the following code:
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e){ if (e.Row.Cells["Status"].Value as string != "Complete") e.Row.Cells["Status"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;}
I don't see any reason that this wouldn't work with images in the cell, but please let me know if you run into anything unexpected.