Date class DevExpress display data in GridView

If you get a dataTable,

To a gridControl assignment,

You will find DateTime type of content which use the default

Display way: [date] display, edit mode is [date]

 

 

 

 

 

 

 Also in edit mode, only the display is presented to the state [date], but my true record of the content here, but accurate to the second.

 

 

Thus the need for DateTime type display interface settings

        ///  <Summary> 
        /// view the incoming desired setting, the view data in accordance with all of the precision type Date seconds display and edit
         ///  </ Summary> 
        ///  <param name = " GV "> </ param> 
        Private  void SetGridViewDateType2SecondLevel (DevExpress.XtraGrid.Views.Grid.GridView GV)
        {

            // to all interface DateTime data types, the length of the date display, accurate to the second 
            gv.Columns.Where (X => x.ColumnType.Name == " DateTime " ) .ToList (). The ForEach (= X> X = .DisplayFormat.FormatString " YYYY the mM-dd-HH: mm: SS " );

            // provide accurate edit box to a date when editing data in the interface class 
            List <the GridColumn> gcList = gv.Columns.Where (X => x.ColumnType.Name == " the DateTime " ) .ToList ();

            RepositoryItemDateEdit nRide = new RepositoryItemDateEdit();
            nRide.CalendarView = CalendarView.Vista;
            nRide.CalendarTimeEditing = DefaultBoolean.True;
            nRide.DisplayFormat.FormatString = "G";
            nRide.DisplayFormat.FormatType = FormatType.DateTime;
            nRide.EditFormat.FormatString = "G";
            nRide.EditFormat.FormatType = FormatType.DateTime;
            nRide.EditMask = "G";

            gv.Columns.Where(x => x.ColumnType.Name == "DateTime").ToList().ForEach(x => x.ColumnEdit = nRide);
        }

 

As I understand it, here's RepositoryItem DateEdit class is subject DateEdit So I first created in the interface DateEdit controls a test used to the parameters and then list through the interface, it is set up, you can understand the controls for that as soon as possible how to use command set.

 

 

 

 

Guess you like

Origin www.cnblogs.com/adamgq/p/12302122.html