How to remove week numbers or GridDateTimeColumn filter?

4 posts, 0 answers
  1. J
    J avatar
    14 posts
    Member since:
    Feb 2018

    Posted 12 Jun Link to this post

    Hello, 

    How can I remove week numbers or GridDateTimeColumn filter please?

  2. Rumen
    Admin
    Rumen avatar
    14030 posts

    Posted 14 Jun Link to this post

    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.
  3. J
    J avatar
    14 posts
    Member since:
    Feb 2018

    Posted 17 Jun in reply to Rumen Link to this post

    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!

  4. Rumen
    Admin
    Rumen avatar
    14030 posts

    Posted 20 Jun Link to this post

    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.
Back to Top