RadDateTimeColumn - picker width

10 posts, 0 answers
  1. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 22 Aug 2008 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 22 Aug 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 22 Aug 2008 Link to this post

    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.


  5. Kiara
    Kiara avatar
    309 posts
    Member since:
    Jul 2006

    Posted 22 Aug 2008 Link to this post

    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
  6. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 26 Aug 2008 Link to this post

    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
  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 26 Aug 2008 Link to this post

    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.
  8. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 26 Aug 2008 Link to this post

    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.
  9. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 27 Aug 2008 Link to this post

    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
  10. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 27 Aug 2008 Link to this post

    Solution: You have to access the SharedCalendar of the control not the DatePicker.
  11. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 27 Aug 2008 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017