Удалите скрытые строки из представления datagridview.
Hi Team, I am trying to filter the DataGridView rows based on the given startdate and enddate. So i am making the rows visible if the date(GridDate) is within the startdate and enddate and making that rows visible in the Grid. How can i remove/delete the hidden rows from the Grid .i.e if(Visible = false) Any help will be apprciated.Below is the code I tried
заранее спасибо
Шаран
Что я уже пробовал:
startDate = "2/25/2015" endDate = "2/25/2015" if (startDate <= endDate)// runs foreach loop if startdate and enddate are valid { foreach (DataGridViewRow dr in Grid.Rows)// loops through rows of datagridview { string deadline = dr.Cells["GridDate"].Value.ToString(); // gets deadline values DateTime deadlineRow = Convert.ToDateTime(deadline); // converts deadline string to datetime and stores in deadlineRow variable if (startSchedule <= deadlineRow && deadlineRow <= endSchedule) // filters deadlines that are => startDate and <= endDate { dr.Visible = true; // display filtered rows here. } else { dr.Visible = false; // hide rows that are not beteen start and end date. } } }