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

Declarative style for GridDateTimeColumnEditor

2 Answers 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gregg
Top achievements
Rank 1
Gregg asked on 04 Mar 2009, 08:27 PM
I'm trying to apply the same style to GridDateTimeColumnEditor that is applied to GridTextBoxColumnEditor as the latter is described here: http://www.telerik.com/help/aspnet-ajax/grdstylingthroughdeclarativecustomeditors.html  , e.g.

 


<
telerik:GridTextBoxColumnEditor id="TextEditor1" runat="server">
 
<TextBoxStyle BackColor="#edffc3"
   
BorderColor="#ecbb0d"
   
BorderStyle="Solid"
   
ForeColor="#7fa822" />
</
telerik:GridTextBoxColumnEditor>

but wiring a GridDateTimeColumnEditor to a GridDateTimeColumn appears to have no effect at all on the underlying DateTimePicker:

<telerik:GridDateTimeColumnEditor id="TextEditor1" runat="server">
 
<TextBoxStyle BackColor="#edffc3"
   
BorderColor="#ecbb0d"
   
BorderStyle="Solid"
   
ForeColor="#7fa822" />
</
telerik:GridDateTimeColumnEditor>

How can I stylize the DateTimePicker in the GridDateTimeColumn so that the style of its text input box is the same as that specified in the GridTextBoxColumnEditor shown above?

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Mar 2009, 07:36 AM
Hello Gregg,

I could not set the styles for the DateInput of the DatePicker by setting the styles through the Editor, but could get it done in the code behind as shown below. Probably you can also try the same.
cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            GridEditFormItem editFormItem = (GridEditFormItem)e.Item; 
            RadDatePicker datepicker = (RadDatePicker)editFormItem["DateTimeColumnUniqueName"].Controls[0]; 
                    datepicker.DateInput.BackColor = System.Drawing.Color.LightYellow; 
                    datepicker.DateInput.BorderColor = System.Drawing.Color.Blue; 
                    datepicker.DateInput.BorderStyle = BorderStyle.Solid; 
                    datepicker.DateInput.ForeColor = System.Drawing.Color.Red; 
         } 
    } 

Thanks
Princy.
0
Gregg
Top achievements
Rank 1
answered on 05 Mar 2009, 03:22 PM
Thanks Princy. That workaround works for me too.
Tags
Grid
Asked by
Gregg
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Gregg
Top achievements
Rank 1
Share this question
or