altaf faki

altaf faki

  • NA
  • 20
  • 1.2k

how to get datagrid button control cell visibility in c#

Feb 14 2014 12:57 AM
how to get datagrid button control cell visibility in c#
 
for e.g.
 
protected void BindVc()
{
string result;
result = "select * from Mst_Vc where isactive='yes' and Start_Date='" + Convert.ToDateTime(dateTimePicker1.Text)+ "' or End_Date ='" + Convert.ToDateTime(dateTimePicker1.Text).AddMonths(20) + "'";
DataTable dtparent = cs.select_result(result);
grdvc.DataSource = dtparent;

foreach (DataGridViewRow row in grdvc.Rows)
{

this.grdvc.Columns["isactive"].Visible = false;
this.grdvc.Columns["vc_id"].Visible = false;

if (Convert.ToDateTime(dateTimePicker1.Text).ToString() == dtparent.Rows[0]["Start_Date"].ToString())
{
var str = row.Cells[1].Value.ToString();
row.Cells[1].Visible = false;
}
else
{

}
}
 
It Is Show me a ERROR that property or indexeres system.windows.forms --it is read only--
please let me know