1. 程式人生 > >GridControl中給某一列新增時間控制元件//獲取時間並轉換為數字//取消勾選,清空該行資料

GridControl中給某一列新增時間控制元件//獲取時間並轉換為數字//取消勾選,清空該行資料

 RepositoryItemComboBox rcboFormat = new RepositoryItemComboBox();//new一個控制元件

 gdcFieldPrompt.RepositoryItems.Add(rcboFormat);//將控制元件新增到GridControl中的Items

 DevGridControlHelper.BindData(gdcFieldPrompt, dtFieldPrompt);//GridControl繫結資料後
                gdvFieldPrompt.Columns[0].OptionsColumn.AllowEdit = false;
                gdvFieldPrompt.Columns[2].ColumnEdit = rcboFormat;//新增控制元件
                gdvFieldPrompt.Columns[3].ColumnEdit = rspnSize;
                gdvFieldPrompt.Columns[4].ColumnEdit = rcboTable;
                gdvFieldPrompt.Columns[5].ColumnEdit = rcboTableColumn;

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

伺服器儲存時間至Oracle資料庫時直接儲存即可:

 //StringBuilder cc =new StringBuilder();
                                //for (int j = 0; j < sIntlckEndTime.Length; j++)
                                //{
                                //    char c = sIntlckEndTime[j];

                                //    if (c != '/' && c != ' ' && c != ':')
                                //    {
                                //        cc.Append(c);
                                //    }
                                //}
                                //sIntlckEndTime = cc.ToString();
                               

客戶端取出時間並進行格式轉換:

 string sIntlckStartTime = CommonFunction.ToStandardTime((DateTime)gdvMailGroupUser.GetRowCellValue(iUsers[i], "INTLCK_START_TIME"), GlobalConstant.SYS_CONVERT_DATETIME_FORMAT);
                    list_item.AddString("INTLCK_START_TIME", sIntlckStartTime);
                    

 

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

GridView複選框,取消選擇行時,清空列的值

  private void gdvMailGroupUser_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
//e.ControllerRow,獲取改變行,gdvMailGroupUser.Columns[""],要改變值的列,列名,false為該列的值
            if (!gdvMailGroupUser.IsRowSelected(e.ControllerRow))
            {
                gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_EMAIL_FLAG"], false);
                gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_SMS_FLAG"], false);
                gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_START_TIME"], "");
                gdvMailGroupUser.SetRowCellValue(e.ControllerRow, gdvMailGroupUser.Columns["INTLCK_END_TIME"], ""); 
            }
        }