Example #1
0
    protected void UIGridViewObject_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        // Hide time information for all dates in day interval mode
        if ((SelectedInterval != null) && SelectedInterval.Equals("day", StringComparison.CurrentCultureIgnoreCase))
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRow drv = ((DataRowView)e.Row.DataItem).Row;

                foreach (DataColumn column in drv.Table.Columns)
                {
                    if (column.DataType.FullName.Equals("system.datetime", StringComparison.CurrentCultureIgnoreCase))
                    {
                        DateTime date = ValidationHelper.GetDateTime(drv[column.Ordinal], DateTime.Now);

                        e.Row.Cells[column.Ordinal].Text = date.Date.ToShortDateString();
                    }
                }
            }
        }
    }
    protected void UIGridViewObject_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        // Hide time information for all dates in day interval mode
        if (SelectedInterval.ToLowerCSafe() == "day")
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRow drv = ((DataRowView)e.Row.DataItem).Row;

                foreach (DataColumn column in drv.Table.Columns)
                {
                    if (column.DataType.FullName.ToLowerCSafe() == "system.datetime")
                    {
                        DateTime date = ValidationHelper.GetDateTime(drv[column.Ordinal], DateTime.Now);

                        e.Row.Cells[column.Ordinal].Text = date.Date.ToShortDateString();
                    }
                }
            }
        }
    }