Reputation: 639
I am using devexpress for windows application. I am having a devxgrid which populates the data and at the last column, I have a hyperlink button named cancel. When I click the cancel button it will do some functionalities that is working great. After that the corresponding cancel button should be disabled. How to make it disabled? Any help is greatly appreciated.
Upvotes: 0
Views: 3080
Reputation: 18290
There are two ways to implement this task:
Create two ButtonEdit repository items. One with the enabled button and another with the disabled button. Then handle the GridView.CustomRowCellEdit event and pass the necessary repository item to the e.RepositoryItem
parameter according to a specific condition. Please see the Assigning Editors to Individual Cells help topic for additional information.
If the button editor has several buttons and their Enabled
state must be changed dynamically, you can implement this functionality by handling the GridView.CustomDrawCell event as shown in the following DevExpress Forum thread:
How to display disabled buttons for particular cells within a ButtonEdit column .
But you should follow the first approach, In case of hyperlinkEdit., for your implementation logic add a custom column with bool values, that will give you condition that whether you will show enabled or disabled hyperlinkEdit repository edit.
If you just want to set this readonly then you do in following way:
you can make the editor read only by handling CustomRowCellEdit
:
private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
{
if(code goes here)
e.RepositoryItem.ReadOnly = true;
}
you can also prevent the editor from being show by handling ShowingEditor
:
private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
{
if (code goes here)
e.Cancel = true;
}
Hope this help you to solve your task..
Upvotes: 1