I have DevExpress GridControl with customized edit form for update or adding rows in VB.net. And the Problem: 1-When user click on Update button on popup edit form, how can execute some extra code with this event. for example do some thing in database and est. 2-how can change the name and visibility of standard buttons on edit form? Please help me. Thanks
Asked
Active
Viewed 1,011 times
1 Answers
0
You will want to handle the GridView's EditFormPrepared event to modify the controls within your custom edit form. For instance:
private void gvEmployees_EditFormPrepared(object sender, EditFormPreparedEventArgs e)
{
EventHandler UpdateButton_Click = null;
var updateButton = e.Panel.Controls.OfType<PanelControl>().FirstOrDefault().Controls.OfType<SimpleButton>().Select(x => x.Text == GridLocalizer.Active.GetLocalizedString(GridStringId.EditFormUpdateButton) ? x : null).FirstOrDefault();
updateButton.Text = "My new button text";
UpdateButton_Click = (s, eventarg) =>
{
//Your code here
};
updateButton.Click += UpdateButton_Click;
}

Brendon
- 1,238
- 1
- 7
- 8
-
Thanks for your reply. when I convert the code to vb.net, I got error with last line of code. would you please check it? – R. Salehi Jan 09 '19 at 03:58
-
In VB.NET you would want to use the [RemoveHandler](https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/removehandler-statement) function. – Brendon Jan 09 '19 at 16:42