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

DataPicker in EditForm: get current id in datepicker.onchange

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
JULIA
Top achievements
Rank 1
JULIA asked on 19 Oct 2010, 10:13 AM

 

Hello,

i have a datepicker inside the edit form (GridEditMode.InForm). What is the best way to achieve the id of the current editable dataItem inside the onChange event of the DatePicker?

The Id is inside the DataKey:
.DataKeys( k => k.Add( ms => ms.HealthEventId ).RouteKey( "tnmId" ) )

Regards,
Timo

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 21 Oct 2010, 04:39 PM
Hello Timo,

You can achieve your goal with the following code snippet:
function onChange(){
var tr = $(this).closest('.t-edit-container').parent();
var dataItem = $('#Grid').data('tGrid').dataItem(tr);
//get the required property.
}

Best wishes,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rafael
Top achievements
Rank 1
answered on 10 Jan 2011, 03:31 PM
My current version is 2010.3.1110
I got error:  Microsoft JScript runtime error: 'OnChangeDate' is undefined 
This template is attached to two Date fields (start/end dates) in nested grid
 Here is my Date.ascx code

<script type="text/javascript" language="javascript">

    function OnChangeDate() {
        var tr = $(this).closest('.t-edit-container').parent();
        //var dataItem = $('#Grid').data('tGrid').dataItem(tr);
    }

    function OnOpenDate(e) {
    }
</script>

<%= Html.Telerik().DatePicker().Effects(ef=>ef.Slide().Opacity().OpenDuration(400).CloseDuration(400))
        .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
        .ClientEvents(events => events.OnChange("OnChangeDate").OnOpen("OnOpenDate"))
        .Value(Model > DateTime.MinValue? Model : DateTime.Today)
%>

Please help what's missed
Tags
Grid
Asked by
JULIA
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Rafael
Top achievements
Rank 1
Share this question
or