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

GridDateTimeColumn date picker control doesn't show

2 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 09 Aug 2013, 06:01 PM
We have a RadGrid control that is built dynamically through code in the Page's init phase.

One of the columns is a GridDateTimeColumn and the data source column is of type System.DateTime.

The problem we are having is that in the edit row (In Place editing), the datetime picker control doesn't render. It appears as a standard textbox control with no image to click to select a date.

The skin we are using is the included 'Telerik' skin, so custom skins should not be an issue. I've also tried removing the skin altogether, but that doesn't seem to work either.

The version of the rad controls we are using is 2013.2.611.40.

Anybody have any suggestions?

Thanks,

Charlie

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 12 Aug 2013, 04:28 AM
Hi Charles,

Please try the below sample code snippet,that works fine at my end,it shows the datepicker in InPlace edit mode.If this doesn't help,can you please provide your full code.

ASPX:
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

C#:
protected void Page_Init(object sender, System.EventArgs e)
    {
        DefineGridStructure();
    }
    private void DefineGridStructure()
    {
        RadGrid grid = new RadGrid();
        grid.ID = "RadGrid1";
        grid.DataSourceID = "SqlDataSource1";
        grid.Skin = "Vista";     
        grid.PageSize = 15;
        grid.AllowPaging = true;     
        grid.AutoGenerateColumns = false;     
      
        grid.AutoGenerateEditColumn = true;
        grid.MasterTableView.EditMode = GridEditMode.InPlace;
 
        GridBoundColumn boundColumn = new GridBoundColumn();
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "OrderID";
        boundColumn.HeaderText = "OrderID";
        
        GridDateTimeColumn date = new GridDateTimeColumn();
        grid.MasterTableView.Columns.Add(date);
        date.DataField = "OrderDate";
        date.HeaderText = "OrderDate";
        date.DataType = typeof(System.DateTime);
        
        // Add the grid to the placeholder 
        this.PlaceHolder1.Controls.Add(grid);
    }

Thanks,
Princy
0
Charles
Top achievements
Rank 1
answered on 12 Aug 2013, 01:30 PM
Thanks. I had essentially the same code.

I found the problem though. It turns out that the control was wider than the column, so the calendar icon was just hidden from view.

I found the control during the ItemDataBound event and set its width to 100%, now all is working as expected.

Thanks again,

Charlie
Tags
Grid
Asked by
Charles
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Charles
Top achievements
Rank 1
Share this question
or