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

How to Set back to old Date when using RadDatePicker

1 Answer 88 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Akki
Top achievements
Rank 1
Akki asked on 21 Jun 2012, 01:27 PM

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

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 21 Jun 2012, 01:44 PM

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.
Tags
Calendar
Asked by
Akki
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or