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

RadDateTimeColumn - picker width

9 Answers 231 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 22 Aug 2008, 10:35 AM
Hi!

I wonder how I can set the width of a raddatetimepicker that comes from a raddatetimecolumn.

i tried to hook into the itemcreated event, but allthough the width of the picker is set, its not visible to the user. so width remains small.

thx in advance & kind regards

9 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Aug 2008, 12:08 PM
Hello Markus,

Try out the following code to access the DatePicker in EditMode and set its width.
aspx:
<telerik:GridDateTimeColumn DataField="date" UniqueName="date">         
 </telerik:GridDateTimeColumn> 

cs:
 protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem ititem = (GridEditableItem)e.Item; 
            RadDatePicker rdtpk = (RadDatePicker)ititem["date"].Controls[0]; 
            rdtpk.Width = Unit.Pixel(50); 
        } 
   } 

Thanks
Princy.
0
Markus
Top achievements
Rank 2
answered on 22 Aug 2008, 12:36 PM
This didn't solved the problem.
Exactly the same code was already in the item created method. In the ItemDatabound method the property is ignored as well.


0
Kiara
Top achievements
Rank 1
answered on 22 Aug 2008, 02:34 PM
This width setting should be applied for the date picker shown when grid item is switched in edit mode - I verified that myself.  Another codeless approach would be to use declarative style editor as discussed in this topic.

If you would like to change the width of the date picker inside the column header when filtering is enabled, use the code from the ItemCreated handler in this demo.

Kiara
0
Markus
Top achievements
Rank 2
answered on 26 Aug 2008, 09:58 AM
Kiara,
thx for your reply.
Unfortunately the width setting is definitely not applied to the control. I reach the codespot where the width is set, the width remains but in the browser I can't see a different width.

I wanted to try your approach, but I can't find a CustomEditor for a RadDateTimePicker.

Could you please show me how you achieved that ? Paste some code or something?
Thx in advancen  & kind regards
0
Sebastian
Telerik team
answered on 26 Aug 2008, 10:50 AM
Hello Markus,

Is it possible that some global style settings for the date picker editor override the width value you attempt to set programmatically? Please check that and remove such style definition if present.

The declarative style editor for the GridDateTimeColumn should be present right under the RadFormDecorator control in your VS toolbox (see the attached screenshot).

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Markus
Top achievements
Rank 2
answered on 26 Aug 2008, 02:14 PM
when i try to access the SharedCalendar or PickerControl member of the RadDateTimeColumnEditor, i end up in an exception saying that SharedCalendar is not available and that PickerControl is not accessible.
0
Markus
Top achievements
Rank 2
answered on 27 Aug 2008, 07:54 AM
just to check that we mean the same thing: i want to set the width of the picker control that pops up, not the textbox control
0
Markus
Top achievements
Rank 2
answered on 27 Aug 2008, 08:07 AM
Solution: You have to access the SharedCalendar of the control not the DatePicker.
0
Sebastian
Telerik team
answered on 27 Aug 2008, 08:18 AM
Hello Markus,

I am glad that you discovered a solution for the issue - thank you for posting it in our public forums. Thus you can help other people which are searching similar solution.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Markus
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Markus
Top achievements
Rank 2
Kiara
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or