chandu gummadi

chandu gummadi

  • NA
  • 67
  • 73.6k

c#.net datagridview control

Oct 6 2012 7:40 AM
hi friends iam using data grid view combobox column
its working properly but at runtime the datagridview combobox column does not show any value if iam click combobox and select any value now only it shows value in combobox. why iam getiing this problem.
  
iam using bellow code....

 DataGridViewComboBoxColumn clnStatus = new DataGridViewComboBoxColumn();
 clnStatus.DataPropertyName = "Status";
 clnStatus.Name = "Absent - Leave - Present";
 clnStatus.DataSource = new string[] { "Absent", "Leave", "Present" };
 DgvTeacherAttendance.Columns.Add(clnStatus);


 private void DgvTeacherAttendance_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
 if (e.ColumnIndex == 0) //set your index of dropdown here 
{
 e.Value = "Absent";
}
}

please can anyone help me send me correct code.
 iam new for this topic...




Answers (1)