Demir Acar

Demir Acar

  • NA
  • 98
  • 25.2k

how Can I do readonly based on condition in devexpress grid

Sep 13 2014 6:14 PM

I want to do if E-MAIL ADDRESS is empty then Column readonly=false else readonly=true .

SqlConnection conn = new SqlConnection(@"Data Source='" + tb6 + "';Initial Catalog='" + tb7 + "';user='" + tb8 + "';pwd='" + tb9 + "'");

SqlCommand cmd = new SqlCommand("SELECT TOP 2 MAILADD 'E-MAIL ADRESS' FROM TABLE", conn);

DataTable tablo = new DataTable();

conn.Open();

SqlDataReader oku = cmd.ExecuteReader();

tablo.Load(oku);

gridControl1.DataSource = tablo;

for (int i = 0; i < gridView1.RowCount; i++)

{

if (gridView1.GetRowCellValue(i, "E-MAIL ADRESS").ToString() == "")

{

//gridView1.Columns[i].OptionsColumn.AllowEdit = false;

MessageBox.Show("EMPTY");

}

else

{

MessageBox.Show("FULL");

//gridView1.Columns["E-MAIL ADRESI"].OptionsColumn.AllowEdit = true;

}

}

}

}

}


Answers (2)