Kategori: Dev Express

Umut Yazılım - Logo Ürünlerinde ve Yazılımda 20 yıllık tecrübe..

Grid koşullu biçimlendirme

Devexpress gridcontrol koşullu biçimlendirme aşağıdaki gibi yapılmaktadır. private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e){GridView View = sender as GridView;if (e.RowHandle >= 0){// string Kategori = View.GetRowCellDisplayText(e.RowHandle, View.Columns[1]); // kolon indexi ilestring gidervarmi = View.GetRowCellDisplayText(e.RowHandle, View.Columns[“GIDERVARMI”]); // Kolon adı ile if (gidervarmi !=””){e.Appearance.BackColor = Color.Green;e.Appearance.ForeColor = Color.White;//e.Appearance.BackColor2 = Color.Green;// sadece BackColor ‘e renk verirseniz satır tek renk…
Devamı

Gridcontrol hangi satır seçili ise form kapanınca aynı satır üzerinde konumlanma.

int row1 = gridView1.LocateByValue(“SIPARIS_NO”, sipno, null);gridView1.FocusedRowHandle = row1;

Gridcontrol Son satıra konumlanma

Aşağıdaki kod ile form açıldığında en son satıra konumlandırma yapılabilir. gridView1.FocusedRowHandle = (gridView1.DataRowCount – 1);

Gridcontrol to DataTable

Devepress gridview ı aşağıdaki kod ile datatable aktarabiliriz. DataTable dt = gridView1.GridControl.DataSource as DataTable;

Gridcontrol seçili satırı silme

Aşağıdaki kod ile gridviewdaki seçili satırı silebiliriz. gridView1.DeleteSelectedRows();

Gridcontrol Satir Ekleme

Bir adet datatable oluşturduktan sonra eklenecek kolonları datable e ekleyip DataRows ile yeni satırı ekleyebiliriz. dt.Columns.Add(new DataColumn(“ID”, typeof(int)));dt.Columns.Add(new DataColumn(“Stok Kodu”, typeof(string)));dt.Columns.Add(new DataColumn(“Stok Adı”, typeof(string)));dt.Columns.Add(new DataColumn(“Miktar”, typeof(double)));dt.Columns.Add(new DataColumn(“Birim”, typeof(string)));dt.Columns.Add(new DataColumn(“FiyatDoviz”, typeof(double)));dt.Columns.Add(new DataColumn(“Para Birimi”, typeof(string)));dt.Columns.Add(new DataColumn(“ToplamDoviz”, typeof(double)));dt.Columns.Add(new DataColumn(“FiyatTL”, typeof(double)));dt.Columns.Add(new DataColumn(“ToplamTl”, typeof(double))); DataRow drs = null;drs = dt.NewRow(); // datatabledrs[“ID”] = SqlClass.dsGenel.Tables[“Orfiche”].Rows[i][“STOKID”].ToString();drs[“Stok Kodu”] = SqlClass.dsGenel.Tables[“Orfiche”].Rows[i][“ADI”].ToString();drs[“Stok Adı”] = SqlClass.dsGenel.Tables[“Orfiche”].Rows[i][“ADI”].ToString();drs[“Miktar”]…
Devamı

Devexpress Gridview Satırları Silme

Aşağıdaki kod ile gridview e ait bütün satırları kolonları silmeden boşaltabilirsiniz. while (gridView1.RowCount != 0){gridView1.SelectAll();gridView1.DeleteSelectedRows();}

Kayıt Silinme onayı

if (XtraMessageBox.Show(“Kayıt Silinecektir Eminmisiniz??”, “Bilgilendirme”, MessageBoxButtons.YesNo) != DialogResult.No){int secilenId = int.Parse(gridView1.GetFocusedRowCellValue(“FATID”).ToString());MySqlClass.SqlExecute(“delete from SATISLAR WHERE ID=” + secilenId + “”, “local”);}

LookUpEdit seçilen değer

private void cmbxisyeri_EditValueChanged(object sender, EventArgs e){try{LookUpEdit editor = (sender as LookUpEdit);DataRowView row = editor.Properties.GetDataSourceRowByKeyValue(editor.EditValue) as DataRowView;string isyeri = row[“NR”].ToString(); }catch (Exception ex){XtraMessageBox.Show(ex.Message);}}