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

[Solved] Clicking on Grid Edit button loses date value.

2 Answers 66 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.
Ammar
Top achievements
Rank 1
Ammar asked on 16 Aug 2011, 04:50 PM
Hi,

In my following grid, when I click on Edit button, all the fields values are persisted, except dates (StartDate & EndDate). The Date fields blanks out. Please help.
@{Html.Telerik().Grid(Model)
            .Name("LineItemGrid")
            .ToolBar(t =>
            {
                t.Insert().ButtonType(GridButtonType.Image);
                t.Position(GridToolBarPosition.Bottom);
            })
            .PrefixUrlParameters(true)
            .DataKeys(keys => keys.Add(item => item.Id))
            .DataBinding(binding => binding
                .Ajax()
                .Select("_SelectTimeAndMaterialLineItem", "TimeAndMaterial")
                    .Delete("_DeleteTimeAndMaterialLineItem", "TimeAndMaterial")
                    .Update("_UpdateTimeAndMaterialLineItem", "TimeAndMaterial")
                    .Insert("_InsertTimeAndMaterialLineItem", "TimeAndMaterial")
                )
            .HtmlAttributes(new { @style = "width=760px" })
            .Columns(columns =>
            {
                columns.Bound(item => item.Id).Width(20);
                columns.Bound(item => item.TMStartDate).Format("{0:dd-MMM-yyyy}").Width(120).Width(100).EditorTemplateName("Date2");
                columns.Bound(item => item.TMEndDate).Format("{0:dd-MMM-yyyy}").Width(120).Width(100).EditorTemplateName("Date2");
                columns.Bound(item => item.SkillCategory).Width(125);
                columns.Bound(item => item.Proficiency).ClientTemplate("<#= Proficiency.Name #>").Width(65);
                columns.Bound(item => item.Location).ClientTemplate("<#= Location.Name #>").Width(65);
                columns.Bound(item => item.LaborTerm).ClientTemplate("<#= LaborTerm.Name #>").Width(65);
                columns.Bound(item => item.RateInCurrencyFormat).Format("{0:c}").Width(40).HtmlAttributes(new { @class = "RateInCurrencyFormat" });
                columns.Bound(item => item.UnitType).ClientTemplate("<#= UnitType.Name #>").Width(50);
                columns.Bound(item => item.Quantity).Width(40);
                columns.Bound(item => item.TotalInCurrencyFormat).Format("{0:c}").Width(55).HtmlAttributes(new { @class = "TotalInCurrencyFormat" });
                columns.Bound(item => item.Override).Width(25)
                    .ClientTemplate("<input type='checkbox' disabled='disabled' name='Override' <#= Override? checked='checked' : '' #> />");
                columns.Command(commands =>
                {
                    commands.Delete().ButtonType(GridButtonType.Image);
                    commands.Edit().ButtonType(GridButtonType.Image);
                }).Title("Actions");
            })
            .Editable(editing => editing.Mode(GridEditMode.InLine))
            .Pageable()
            .Reorderable(r => r.Columns(true))
            .Resizable(r => r.Columns(true))
            .Sortable()
            .Filterable()
            .Render();      }

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 17 Aug 2011, 07:46 AM
Hi Ammar,

 Unfortunately the provided code does not indicate why this problem occurs. Your implementation looks quite similar to our editing online demo and should have worked without a glitch. Is there a chance to provide a sample project which reproduces the problem? We will check it out and see what went wrong.

Greetings,
Atanas Korchev
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
Ammar
Top achievements
Rank 1
answered on 31 Aug 2011, 03:37 PM
Hi Atanas,

I removed .Format("{0:dd-MMM-yyyy}") from the start date and end date and it is working now!

Regards,
Ammar
Tags
Date/Time Pickers
Asked by
Ammar
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Ammar
Top achievements
Rank 1
Share this question
or