none
How to deselect selected date in a data grid in asp.net c#.i want to remove selected date from the data grid when i deselect the date from the date time picker RRS feed

  • Question

  • How to deselect selected date in a data grid  in asp.net c#.i want to remove selected date from the data grid when i deselect the date from the Month Calendar



    • Edited by Sherin123 Tuesday, May 7, 2019 6:18 AM
    Wednesday, May 1, 2019 5:45 AM

Answers

  • I find the code

    How to deselect selected date in a data grid  in asp.net c#.i want to remove selected date from the data grid when i deselect the date from the Month Calendar

    this contains insertion and remove code

    txtdate.Text = DocDate.SelectionEnd.ToShortDateString();            string date = DocDate.SelectionEnd.ToLongDateString();            DataGridViewRow dr = newDataGridViewRow();            dr.CreateCells(DGView);            dr.Cells[4].Value = txtdate.Text;                       String[] dateParts = date.Split(' ');            dr.Cells[3].Value = dateParts[2];            dr.Cells[2].Value = dateParts[1];            dr.Cells[1].Value = dateParts[0];            DGView.Rows.Add(dr);            int c = DGView.Rows.Count;            if (DGView.Rows.Count >1)            {                for (int i = 0; i < DGView.Rows.Count-1; i++)                {                    if (DGView.Rows[i].Cells[4].Value.ToString() == txtdate.Text)                    {                        DGView.Rows.RemoveAt(c-1);                        DGView.Rows.RemoveAt(i);                    }                                    }

     

    • Marked as answer by Sherin123 Tuesday, May 7, 2019 6:17 AM
    • Edited by Sherin123 Tuesday, May 7, 2019 6:17 AM
    Tuesday, May 7, 2019 6:17 AM