zoukankan      html  css  js  c++  java
  • *****How to access a repositoryItemButtonEdit value from a FileDlg

    from:
    http://www.devexpress.com/Support/Center/p/Q205500.aspx

    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.

    =================================

    Set the vGridControl.ActiveEditor.EditValue property to the FileDialog's FileName property value.

    =================================

    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.

     

     
  • 相关阅读:
    SET ROWCOUNT,SET NOCOUNT
    JS是按值传递还是按引用传递?
    Debug目录、Release目录,bin目录、obj目录,vshost.exe.config文件、.exe.config文件分析【C#】
    写window应用程序日志System.Diagnostics.EventLog.WriteEntry
    X-UA-Compatible设置兼容模式
    Linq的Distinct方法的扩展
    SQL Server 系统表简介
    sql server 常用的系统存储过程
    C# Timer用法及实例详解
    ASP.NET MVC内置的Filter实现介绍
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2109798.html
Copyright © 2011-2022 走看看