zoukankan      html  css  js  c++  java
  • Mask for a single cell in datagrid

    from:

    http://www1.devexpress.com/Support/Center/p/Q130467.aspx

    hi,
    I am using a datagrid to display values. I have given mask as numeric and edit Mask and UseMaskAsDisplay properties as shown below:

    dtvFilteredData.Columns[ "Movement %" ].ColumnEdit = new DevExpress.XtraEditors.Repository. RepositoryItemTextEdit ();

    ((DevExpress.XtraEditors.Repository. RepositoryItemTextEdit )dtvFilteredData.Columns[ "Movement %" ].ColumnEdit).Mask.MaskType = DevExpress.XtraEditors.Mask. MaskType .Numeric;

    ((DevExpress.XtraEditors.Repository. RepositoryItemTextEdit )dtvFilteredData.Columns[ "Movement %" ].ColumnEdit).Mask.EditMask = "#,##,##,##,##,##,##,##,##,##,##,##,##,##0.00" ;

    ((DevExpress.XtraEditors.Repository. RepositoryItemTextEdit )dtvFilteredData.Columns[ "Movement %" ].ColumnEdit).Mask.UseMaskAsDisplayFormat = true ;

    But after displaying the values, when i click a particular cell, i want to edit its value. But at this time, the value in that particular cell (And not entire column)must show 6 decuimal places instead of 2 as indicated in the mask. So is it possible to give multiple masks for that column- one for normal mode and one when editing the cell value?

    Waiting for your answer..its really urgent...

    Thanks,
    Regards,
    Abi

    ----------------------------------------------

    Hello Abi,

    Yes, it's possible to accomplish your task using the GridView.ShownEditor event, for example:

    [C#]

    private void gridView1_ShownEditor(object sender, EventArgs e)
            {
                GridView view = sender as GridView;
                if (view.FocusedColumn.FieldName == "Movement %")
                {
                    DevExpress.XtraEditors.TextEdit edit = (view.ActiveEditor as
    DevExpress.XtraEditors.TextEdit);
                    edit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                    edit.Properties.Mask.EditMask = "n6";
                }
            }

    Thank you,
    Paul

     

  • 相关阅读:
    洛谷P3799 妖梦拼木棒
    bzoj1008 [HNOI2008]越狱
    洛谷P3414 SAC#1
    洛谷P1078 文化之旅
    bzoj1053 [HAOI2007]反素数ant
    洛谷P1588 丢失的牛
    bzoj1085 [SCOI2005]骑士精神
    noip2016 蚯蚓
    noip2016 换教室
    html笔记03:表单
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2296201.html
Copyright © 2011-2022 走看看