Click here to Skip to main content
16,020,378 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more: , +
Hi all,

I have one datagridview in my windows application which gets date values from database now i want to pass null value to those cell in column[1] who have date value "01-Jan-1900". please tell me how can i do that ?
Posted

 
Share this answer
 
Please explain by code block how to bind your data grid ... ?
 
Share this answer
 
i put below code at rowsAdd event of datagridview and i worked

C#
string datetimevalue = "01/01/1900 12:00:00 AM";
            try
            {
                for (int i = 0; i < dgvRenewalHistory.Rows.Count; i++)
                {
                    if (dgvRenewalHistory.Rows[i].Cells["Renewal_On"].Value.ToString() == datetimevalue)
                    {
                        dgvRenewalHistory.Rows[i].Cells["Renewal_On"].Value = "";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
 
Share this answer
 
v2
Hi friend,

As i m new to asp .net , i think it is better to write a stored procedure wherever in date column you find the string "01-Jan-1900" update it to NULL.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900