RadDatePicker without time

6 posts, 0 answers
  1. Rafael
    Rafael avatar
    3 posts
    Member since:
    Oct 2010

    Posted 29 Aug 2012 Link to this post

    When I use RadDatePicker and update the item, the label show the result 29/08/2012 00:00:00.

                            <telerik:RadDatePicker ID="RadDatePicker1" runat="server" DbSelectedDate='<%# Bind("rEstimatedDelivery") %>' >
                                <DateInput runat="server" DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy" />
                                <Calendar runat="server" ViewSelectorText="dd/MM/yyyy" TitleFormat="dd/MM/yyyy" />
                            </telerik:RadDatePicker>

    How can I update only 29/08/2012, without 00:00:00 ?

    Thank you!
  2. Eyup
    Admin
    Eyup avatar
    2912 posts

    Posted 03 Sep 2012 Link to this post

    Hello Rafael,

    Could you please elaborate some more on your specific scenario? Exactly what do you mean by "update the item"?

    I have created a sample RadGrid web site to test the described appearance. On my side everything works as expected. Could you please check out the attached application and try to distinguish the crucial differences between our projects?

    All the best,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET AJAX banner
  4. Rafael
    Rafael avatar
    3 posts
    Member since:
    Oct 2010

    Posted 03 Sep 2012 Link to this post

    Eyup,

    I want to save only the date on database, but the RadDatePicker saved date and time. The RadDateTimePicker need to save date and time, RadDatePicker need to save only date, right? But RadDatePicker is working same RadDateTimePicker. What I need to do to solve the problem?

    Result when save RadDatePicker:
    03/09/2012 00:00:00

    But I want to save:
    03/09/2012

  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Sep 2012 Link to this post

    Hi,

    Try saving the date as shown below.
    C#:
    string s=RadDateTimePicker1.SelectedDate.Value.ToShortDateString();

    Thanks,
    Shinu.
  6. Irfan Ali
    Irfan Ali avatar
    1 posts
    Member since:
    Jan 2016

    Posted 18 Jan in reply to Shinu Link to this post

    Shinu your solution not working we want to get date only but RadDatePicker returning date and time though formatted date as you suggested.
  7. Eyup
    Admin
    Eyup avatar
    2912 posts

    Posted 21 Jan Link to this post

    Hello Irfan,

    You can access the control using ItemCommand/UpdateCommand/InsertCommand methods provided by RadGrid and modify the value before passing it to the database:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-editinsert-mode

    Alternatively, you can try using the ExtractValues method:
    http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/manual-crud-operations/defaultcs.aspx


    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET AJAX banner