You must Sign In to post a response.
  • Category: ASP.NET

    How to check box same column value is checked in gridview

    i have gridview as follows

    Selectdata Slipno Slipdate Location Section Status

    Checkbox 123 28.05.2018 1001 Sordi New
    Checkbox 123 28.06.2018 1002 Ferke New

    i want to check if suppose both same Slipno 123, checkbox is selected. i want to show the message, "For selected slipno checkbox is selected".

    for that how to do in c#.
  • #769796
    Hi Rao,

    Try something like this

    private void myDatagridView_SelectionChanged(object sender, EventArgs e)
    {
    if (myDatagridView.SelectedCells.Count > 0)
    {
    //Get selected row index
    int selectedRowIndex = myDatagridView.SelectedCells[0].RowIndex;
    //Get selected row data
    DataGridViewRow selectedRow = myDatagridView.Rows[selectedrowindex];
    //Read the value of the selected column
    string cellValue = Convert.ToString(selectedRow.Cells["Your_Column_Name"].Value);

    //compare the value and show whatever message you want

    }
    }


  • Sign In to post your comments