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

[Solved] Pass value to controller without DataBinding

0 Answers 49 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 31 Dec 2010, 02:49 PM
Hi,

    I have a page with some ActionLink responsible to generate report.  I tried to use a datetimepicker, but I'm not able to pass value to my controller.  Here is the code, but ViewData is not available in javascript.

<%= Html.ActionLink("Members expire", "ExportMembersExpire", "Report", new { Expiration = ViewData["DateExpire"] }, null) %> at date <%= Html.Telerik().DatePicker().Name("DateExpire").Value(DateTime.Today.AddMonths(3)).ClientEvents(e => e.OnChange("OnChangeDateExpiration"))%>
 
<script language='Javascript'>
    function OnChangeDateExpiration() {
        var datepicker = $('#DateExpire').data('tDatePicker');
        var date = datepicker.value();
 
        ViewData["DateExpire"] = date;
    }
</script>

Thank you
Tags
Date/Time Pickers
Asked by
Steve
Top achievements
Rank 1
Share this question
or