This is a migrated thread and some comments may be shown as answers.

How to remove week numbers or GridDateTimeColumn filter?

3 Answers 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 12 Jun 2019, 10:36 AM

Hello, 

How can I remove week numbers or GridDateTimeColumn filter please?

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 14 Jun 2019, 10:31 AM
Hi,

Access the DatePicker as shown in this example https://www.telerik.com/forums/help-with-griddatetimecolumn#P0sY-QDxnE6EhS5wHnuyJQ and set its Calendar ShowRowHeaders property to false.

Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
J
Top achievements
Rank 1
answered on 17 Jun 2019, 04:21 PM

Thanks for your help Rumen.  I likely misunderstand something.  How does changing the Tooltip affect showing the week's number in the GridDateTime column date dropdown?

Also, I don't have a calendar ShowRowHeaders property, so far as I can tell.  It's a GridDateTimeColumn.  What am I missing?

Thank you!

0
Rumen
Telerik team
answered on 20 Jun 2019, 12:54 PM
Hi J M,

For your convenience I created a complete solution based on my earlier suggestion and the use of OnItemDataBound to access the shared calendar from the datepicker:

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="Scriptmanager1" runat="server" />
 
        <telerik:RadGrid OnItemDataBound="RadGrid2_ItemDataBound" ID="RadGrid2" runat="server" AutoGenerateColumns="False"
                    OnNeedDataSource="RadGrid2_NeedDataSource" OnUpdateCommand="RadGrid2_UpdateCommand">
                    <MasterTableView EditMode="InPlace">
                        <Columns>
                            <telerik:GridDateTimeColumn HeaderText="Dates" DataField="Dates" DataFormatString="{0:D}">
                            </telerik:GridDateTimeColumn>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton">
                            </telerik:GridEditCommandColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
 
        <telerik:RadCalendar ID="RadCalendar1" runat="server" ShowRowHeaders="false" ShowColumnHeaders="false"></telerik:RadCalendar>
        <telerik:RadDatePicker ID="RadDatepicker1" runat="server">
            <Calendar ShowColumnHeaders="false" ShowRowHeaders="false"></Calendar>
        </telerik:RadDatePicker>
    </form>
</body>
</html>



Default.aspx.cs

using System;
using System.Data;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
{
    private void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RadGrid2.EditIndexes.Add(0);
        }
    }
 
    private DataTable DataSource2
    {
        get
        {
            if (Session[Request.CurrentExecutionFilePath + "Dates2"] == null)
            {
                DataTable table = new DataTable("Events");
                DataColumn column = new DataColumn();
                column.ColumnName = "Dates";
                column.DataType = typeof(System.DateTime);
                table.Columns.Add(column);
 
                table.Rows.Add(new object[] { new DateTime(2006, 3, 10) });
                table.Rows.Add(new object[] { new DateTime(2006, 3, 15) });
                table.Rows.Add(new object[] { null });
                table.Rows.Add(new object[] { System.DBNull.Value });
                table.Rows.Add(new object[] { new DateTime(2006, 4, 1) });
 
                Session[Request.CurrentExecutionFilePath + "Dates2"] = table;
            }
 
            return (DataTable)Session[Request.CurrentExecutionFilePath + "Dates2"];
        }
    }
 
    protected void RadGrid2_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        RadGrid2.DataSource = DataSource2;
    }
 
    protected void RadGrid2_UpdateCommand(object source, GridCommandEventArgs e)
    {
        RadDatePicker picker = ((e.Item as GridEditableItem)["Dates"].Controls[0] as RadDatePicker);
        object newDate = picker.DbSelectedDate;
 
        DataSource2.Rows[e.Item.DataSetIndex]["Dates"] = newDate == null ? DBNull.Value : newDate;
    }
 
    protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
        {
            GridEditableItem item = (GridEditableItem)e.Item;
            RadDatePicker picker = (RadDatePicker)item["Dates"].Controls[0];
            picker.SharedCalendar.ShowRowHeaders = false;
            picker.SharedCalendar.ShowColumnHeaders = false;
            picker.DatePopupButton.ToolTip = "YourText";
 
        }
    }
}



Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
J
Top achievements
Rank 1
Answers by
Rumen
Telerik team
J
Top achievements
Rank 1
Share this question
or