Reputation: 5330
I have an Aspxgridview control and I enabled editing. So there is a column as "Edit". When I press it, it popups the row edit window --you all know that so far.
There are 2 columns has to be edited when I press the edit button. And I want to show a red image instead of edit button when this columns are not edited yet(I have an edited bool value in my database -0 default), after editing, I want this image to be changed with a green one. So I have the boolean column, I have 2 images and a command column with an editbutton. Possible to make that happen?
Thanks in advance.
Upvotes: 1
Views: 3556
Reputation: 11376
Yes, it is possible to implement. First, you should set the CommandColumn.ButtonType to the Image value. To customize the button's image, use the ASPxGridView's CommandButtonInitialize event. Here is a sample code:
protected void ASPxGridView1_CommandButtonInitialize(object sender, ASPxGridViewCommandButtonEventArgs e) {
if(e.ButtonType == ColumnCommandButtonType.Edit) {
if(e.VisibleIndex % 2 == 0)
e.Image.Url = "Images/Copy.bmp";
else
e.Image.Url = "Images/Design.bmp";
}
}
Upvotes: 3