This question is locked. New answers and comments are not allowed.
I know that I can read the datepicker value by :
but i want to set the value by useing "words" such as "Today", "Last Week" and so on , how ?
var
datepicker = $(
"#DatePicker"
).data(
'tDatePicker'
);
var
date = datepicker.value();
but i want to set the value by useing "words" such as "Today", "Last Week" and so on , how ?
4 Answers, 1 is accepted
0
Hello Nebras,
Rosen
the Telerik team
Please refer to this online demo which demonstrates how to achieve such functionality.
Regards,Rosen
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Nebras
Top achievements
Rank 1
answered on 02 Mar 2011, 04:18 PM
I know them but what I want is to make the "words" to be in a dropdownlist
which doesn't has a "class" attribute to be used in this function
so I created a dropdownlist with :
any help please ??
which doesn't has a "class" attribute to be used in this function
<% Html.Telerik().ScriptRegistrar().OnDocumentReady(
() => {%>
$(
'.humanReadableExamples a'
).click(
function
(e) {
e.preventDefault();
setTimeout($.proxy(
function
() {
$(
'#DatePicker-input'
)
.focus()
.val($(
this
).text());
},
this
), 0); }); <%}); %>
so I created a dropdownlist with :
<%=Html.Telerik().DropDownList()
.Items(columns =>
{
columns.Add().Text(
"All"
).Value(
"All"
);
columns.Add().Text(
"Today"
).Value(
"Today"
);
columns.Add().Text(
"Last Week"
).Value(
"Last Week"
);
columns.Add().Text(
"Last Month"
).Value(
"Last Month"
);
columns.Add().Text(
"Last Year"
).Value(
"Last Year"
);
}
).ClientEvents(c=>c.OnChange(
"OnChange"
))
.Name(
"fffff"
)
%>
function
OnChange(e) {
if
(e.value !=
"All"
) {
var
datepicker = $(
"#DatePicker"
).data(
'tDatePicker'
);
????????
//datepicker.value() = e.value;
}
}
</script>
any help please ??
0
Accepted
Nebras,
You may apply the same approach as shown in the demo, but instead using the links click event, you should use the dropDownList change event:
Regards,
Rosen
the Telerik team
You may apply the same approach as shown in the demo, but instead using the links click event, you should use the dropDownList change event:
<script type=
"text/javascript"
>
function
OnChange(e) {
if
(e.value !=
"All"
) {
$(
'#DatePicker-input'
)
.focus()
.val(e.value)
.trigger(
'change'
);
}
}
</script>
Regards,
Rosen
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Nebras
Top achievements
Rank 1
answered on 02 Mar 2011, 05:31 PM
It works .. Many Thanks ..