How to Set back to old Date when using RadDatePicker

2 posts, 0 answers
  1. Akki
    Akki avatar
    79 posts
    Member since:
    Nov 2011

    Posted 21 Jun 2012 Link to this post


    Hi,

    I have used a 2 RadDatepicker controls, one for start date and one for end date.
    When End Date is less than start date, i am triggering an error message But the problem is once i come back from error message
    EndDate would still have new Date which i picked.. How can i set it back to original Date ??

    Ex: Start Date : 1/1/1999  End Date 1/1/2000
    I will Modify Modify  Start Date : 1/1/1999 End Date  1/1/1998

    Now End Date should not be 1/1/1998 , it should be set back to 1/1/2000 on error.


    below is code

      <telerik:GridTemplateColumn HeaderText="Start" UniqueName="fispersrt" DataField="fispersrt"
                                    Visible="true">
                                    <ItemTemplate>
                                        <telerik:RadDatePicker ID="rdDtStrtpkr" runat="server" SelectedDate='<%#Eval("fispersrt")%>'
                                            Width="100%" CssClass="txtbx" onchange="javascript:return DirtyFlagUpdate()">
                                            <ClientEvents OnDateSelected="OnDateSelected" />
                                        </telerik:RadDatePicker>
                                    </ItemTemplate>
    </telerik:GridTemplateColumn
    <telerik:GridTemplateColumn HeaderText="End" UniqueName="fisperend" DataField="fisperend"
                                    Visible="true">
                                    <ItemTemplate>
                                        <telerik:RadDatePicker ID="rdDtEndpkr" runat="server" SelectedDate='<%#Eval("fisperend")%>'
                                            Width="100%" CssClass="txtbx" onchange="javascript:return DirtyFlagUpdate()">
                                            <ClientEvents OnDateSelected="OnDateSelected" />

                                        </telerik:RadDatePicker>
                                    </ItemTemplate>
      </telerik:GridTemplateColumn>

      function OnDateSelected(sender, e) {
                if (e.get_newDate() < e.get_oldDate()) {
                    DisplayErrorMessage('ERRSA20404', 'Error');

                }
            }

    Regards,
    Akki
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 21 Jun 2012 Link to this post

    Hello Akki,

    Attached you will find a sample RadGrid web site where the requested functionality is demonstrated. Please check out the provided application and try to make best avail out of it.

    Greetings,

    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 is Ready for VS 2017
Back to Top