Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4695
Empty the datetime field in the ultragrid
posted

Dear all,

In the ultragrid1, there is a datetime field named as "EXPIRY_DATE". How to make it show as empty when it is null or it is DateTime.MinDateTime. I am trying to assign null value to it, but it throw exception. Is there any other method without amending the datetime field to be string??

private void ultragrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
        {
           
            if (Convert.ToDateTime(e.Row.Cells["EXPIRY_DATE"].Value) == DateTime.MinValue)
                e.Row.Cells["EXPIRY_DATE"].Value = null;  // it throws exception that cannot convert
        }