search for a value in a Datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweetneel
    New Member
    • Oct 2008
    • 42

    search for a value in a Datagridview

    I am developing a windows application. i have a datagridview control in this applicaion. now i need to search for a value in this datagridview control. i am populating the value by a dataset in this grid.
  • semomaniz
    Recognized Expert New Member
    • Oct 2007
    • 210

    #2
    Please show us what exactly you have done so far.

    Comment

    • sweetneel
      New Member
      • Oct 2008
      • 42

      #3
      string searchString = this.dtToday.Te xt;
      foreach (DataGridViewRo w row in grdClientDetail s.Rows)
      {
      if(row.Cells["Followup Date"].Value.ToString ().Contains(sea rchString ))
      {
      grdClientDetail s.Rows[row.Index].Selected=true;

      break;
      }


      it is working but, it cant select more than one row at a tome.

      Comment

      • semomaniz
        Recognized Expert New Member
        • Oct 2007
        • 210

        #4
        This is what i would do. Add a check box inside the gridview as a templatefield. Then instead of selecting the row i would check the check box. This should give you multiple rows being checked

        Comment

        Working...