Skip to content

Commit d4fef2d

Browse files
committed
docs(daterangepicker): update server-side programming section
1 parent 4efb2e3 commit d4fef2d

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

controls/daterangepicker/server-side-programming/events/overview.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,20 @@ position: 0
1616

1717
The **RadDateRangePicker** controls expose the following server-side event:
1818

19-
* [RangeSelectionChanged]({%slug daterangepicker/server-side-programming/events/rangeselectionchanged%}) occurs when the user changes the value of the control, either when control area loses focus after the user has typed a new value, or when the user selects a new value in the popup calendar or time view control.
19+
* [RangeSelectionChanged]({%slug daterangepicker/server-side-programming/events/rangeselectionchanged%}) occurs after a Postback, when the value of the control has been changed.
2020

21+
To achieve AutoPostBack behavior with the **RadDateRangePicker**, you can use the [client-side DateSelected event]({%slug daterangepicker/client-side-programming/events/ondateselected%}) to trigger a postback for submitting the changes to the server-side. Otherwise the **RangeSelectionChanged** event will be triggered after a postback initiated by another postback control (e.g. Submit button):
2122

22-
>note In order for the server-side events to be fired the **RadDateRangePicker** should trigger postback. You need to set the **AutoPostBack** property to **true**.
23-
>
23+
````JavaScript
24+
function OnDateSelected(sender, args) {
25+
// trigger a postback when both start and end dates are selected
26+
if (sender.get_rangeSelectionStartDate() && sender.get_rangeSelectionEndDate()) {
27+
args.set_shouldPostBack(true);
28+
}
29+
}
30+
````
2431

32+
See live sample of handling the server event in our [Server-side events demo](https://demos.telerik.com/aspnet-ajax/daterangepicker/server-side-programming/server-side-events/defaultcs.aspx)
2533

2634
# See Also
2735

controls/daterangepicker/server-side-programming/events/rangeselectionchanged.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ position: 6
1010

1111
# RangeSelectionChanged
1212

13-
**RadDatePicker** provides the **RangeSelectionChanged** server event, which is triggered when the user changes the value of the control, either when input area loses focus after the user has typed a new value, or when the user selects a new value in the popup calendar control. This event does not fire unless the **AutoPostBack** property is**True**.
13+
**RadDatePicker** provides the **RangeSelectionChanged** server event, which is triggered when the user changes the value of the control and a Postback is done so the change gets submitted to the server.
1414

1515
>note
1616
The event handler is not called unless the date and/or time actually changes. If the user makes a change that results in the same value (for example, typing a different string that parses to the same value), a postback occurs but the **RangeSelectionChanged** event handler is not triggered.
@@ -23,13 +23,9 @@ The **RangeSelectionChanged** event handler receives two arguments:
2323

2424
2. A **RangeSelectionChangedEventArgs** object. This object has the following two properties:
2525

26-
* **OldStartDate** is the Start Date value before the change.
27-
28-
* **NewStartDate** is the Start Date value after the change.
26+
* **StartDate** is the Start Date value after the change.
2927

30-
* **OldEndDate** is the End Date value before the change.
31-
32-
* **NewEndDate** is the End Date value after the change.
28+
* **EndDate** is the End Date value after the change.
3329

3430
You can use this event to respond in server-side code when the user changes the value.
3531

0 commit comments

Comments
 (0)