*****How to access a repositoryItemButtonEdit value from a FileDlg
I insert into my verticalGrid by programation a repositoryItemButtonEdit (as a row) that has of course a buttonEdit and a value, when the user click on the buttonEdit it make a fileDLG appears, I want to give back the path to the repositoryItemButtonEdit.OwnerValue and affect it to the tag's row.
To do this work, I subscibe to the event repositoryItemButtonEdit.ButtonClick in the Method OnClick a wrote the instruction fileDlg.ShowDialog() but I dont know how to access to the base row from here.
=================================
=================================
I've got a problem setting GridView cell value from RepositoryItemButtonEdit that shows my form as a dialog.
I did it like in two Examples:
[C#]
private static void buttonEdit_ButtonClick(object sender, ButtonPressedEventArgs e)
{
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Filter = "Файлы шаблонов(*.dot)|*.dot";
if (dlg.ShowDialog() == DialogResult.OK)
(sender as ButtonEdit).EditValue = new System.IO.FileInfo(dlg.FileName).FullName;
}
}
[C#]
private void buttonEdit1_ButtonPressed(object sender, ButtonPressedEventArgs e) {
ButtonEdit editor = (ButtonEdit)sender;
int buttonIndex = editor.Properties.Buttons.IndexOf(e.Button);
if (buttonIndex == 0) {
Form2 form = new Form2(editor.EditValue);
if (form.ShowDialog(this) == DialogResult.OK)
editor.EditValue = form.EditingValue;
}
}
as for the first example I implemented it and it works and changes the cell value and text.
And here is the problem: when I use my own form as a dialog editor.EditValue doesn't affect the cell value:
[C#]
private static void onButtonClick(object sender, ButtonPressedEventArgs e)
{
(sender as ButtonEdit).EditValue = "It still works";
if (new myDialogForm().ShowDialog() == DialogResult.OK)
(sender as ButtonEdit).EditValue = "Now it affects nothing!!!";
else
return;
(sender as ButtonEdit).EditValue = "And here as well =(";
}
I partially solved the problem using:
[C#]
(((sender as ButtonEdit).Parent as GridControl).FocusedView as GridView).SetFocusedValue("Now it works");
but I dont like it because it doesn't fire gridView's CellValueChanging event.