Telerik Forums
UI for ASP.NET MVC Forum
4 answers
572 views
Hi,

Below is the beginning of the kendo grid and its template.

@(Html.Kendo().Grid<CompanyDomainView>()
    .Name("customer-grid")
    .ClientDetailTemplateId("customerTemplate")
    ........

<script id="customerTemplate" class="gridtemplates" type="text/x-kendo-tmpl">
    <section>
        <div class="k-widget inline-grid-box">
.....

The template have a SAVE and a CANCEL button and I have problem with the CANCEL button.
When the user makes some changes and hit the cancel button, the template content should go back and show its previous data.

I don't want to refresh all the controls in the template in code, just to remove current instance of the template from the kendo-list of created templates.
I am able to programmatically collapse and expand any row in the grid, but I don't know how to instruct kendo to forget a template.

Think this: I collapse the row, remove its created template and expand the row again and a fresh template with data from its parent (the row).
How can i do that ?
Thanks.
Jacob
Top achievements
Rank 1
 answered on 13 Mar 2015
1 answer
149 views
Hi,

I created a new project via the Telerik MVC template. When using Scaffolding to generate a controller and view for an EF domain, if there is a datetime field it'll be mapped to a Telerik DateTimePicker somehow as code in the razor view will look like this code, where at run time with 'view source' I can see the KendoUi control mentioned. My question is how to access the datetimepicker for example to add events?

 

<div class="form-group">
    @Html.LabelFor(model => model.from_date, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-10">
        @Html.EditorFor(model => model.from_date, new { htmlAttributes = new { @class = "form-control" } })
        @Html.ValidationMessageFor(model => model.from_date, "", new { @class = "text-danger" })
    </div>
</div>

 

Dimiter Madjarov
Telerik team
 answered on 13 Mar 2015
1 answer
558 views
My code:
.Series(series => {
            series.Column(s => s.XXXXX)
            .Overlay(ChartBarSeriesOverlay.None)            
            .Labels(labels => labels                                     
                .Background("transparent")
                .Template("\n#= dataItem.XXXX#%\n#= dataItem.YYYY#")                
                .Visible(true));           
        })

I want to insert an image into label template. So, how to do it?
Iliana Dyankova
Telerik team
 answered on 13 Mar 2015
1 answer
432 views
Hi,

I am trying to use TextEditor as the EditorTemplate for Grid.  When I click on Edit the column value is not being passed on the editor.  Not sure what I am doing wrong.  Any help is appreciated.

@(Html.Kendo()
      .Grid<WellsRxWeb.Models.UserNotesModel>()
      .Name("gridUserNotes")
      .Columns(columns => {
        columns.Bound(p => p.NotesId).Title("Id").Visible(false);
        columns.Bound(p => p.UserName).Title("UserName").Visible(false);
        columns.Bound(p => p.UserNoteText).Title("Notes").EditorTemplateName("TextEditor");
        columns.Bound(p => p.ModifiedBy).Title("Saved By");
        columns.Bound(p => p.Modified).Title("Saved").Format("{0:MM/dd/yyyy}");
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
      })
      .ToolBar(toolbar => { toolbar.Create(); })
      .Editable(editable => editable.Mode(GridEditMode.InLine))
      .Pageable()
      .Sortable()
      .Filterable()
      .Pageable(pageable => pageable
                                    .Refresh(true)
                                    .PageSizes(true)
                                    .ButtonCount(5))
      .Filterable()
              .Reorderable(r => r.Columns(true))
        .Resizable(r => r.Columns(true))
        .ColumnMenu()
 
      .DataSource(dataSource => dataSource
                                          .Ajax()
                                          .Model(model => {
                                            model.Id(o => o.NotesId);
                                            model.Field(p => p.UserName).Editable(false);
                                            model.Field(p => p.ModifiedBy).Editable(false);
                                            model.Field(p => p.Modified).Editable(false);                                           
                                          })
                                          .Read(read => read.Action("UserNotes_Read", "User").Type(HttpVerbs.Get).Data("additionalData"))
                                          .Create(create => create.Action("UserNotes_Create", "User").Data("additionalData"))
                                          .Update(update => update.Action("UserNotes_Update", "User").Data("additionalData"))
                                          .Destroy(destroy => destroy.Action("UserNotes_Destroy", "User").Data("additionalData").Type(HttpVerbs.Post))
                                          .Events(events => { events.RequestEnd("gridRequestEnd"); }))
 
)

TextEditor.cshtml
@model WellsRxWeb.Models.UserNotesModel
 
@(Html.Kendo().EditorFor(model => model.UserNoteText)
      .Name("TextEditor")
      .HtmlAttributes(new { style = "width: 740px;height:440px" })
)
Dimo
Telerik team
 answered on 13 Mar 2015
9 answers
353 views
Hello,

 I use scheduler control in my project. It is like that http://demos.telerik.com/aspnet-mvc/scheduler/index
I have problem about double click event on ipad or other tablets for popup window. How I fix it ?
Kiril Nikolov
Telerik team
 answered on 12 Mar 2015
9 answers
443 views
I searched the forum for my issue but the suggestions here (escaping the # with \\ or \\\\) did not work.

  columns.Bound(Function(l) l.Path).Title("File Path").ClientTemplate("<a href=""#= Path.replace('ROOT\\', '\\\\test123.com\\test\\WAV\\Compliance\\') #"" target=""_blank"">#= Path.replace('ROOT\\', '\\\\cmutual.com\\fsroot\\WAV\\Compliance\\') #</a>")

If my Path contains a "#", the link gets cut off after that symbol (and does not open the linked file, obviously). 

Interestingly, when the link is clicked, for a second the whole correct path is in the address bar (with the "#" and everything after it), but after a second, it gets replaced with the cut off path.

Thanks,
Julia
                          
Julia
Top achievements
Rank 1
 answered on 12 Mar 2015
2 answers
250 views
Hello,

I am having an issue with a couple of Kendo grids on our Mvc project. I was on an older version of Kendo, and I thought upgrading to the latest might help, but after upgrading the problem remained the same. What happens is sometimes when I edit a row in the grid, the action will not get hit in the controller at all. When I first load the application, the first couple of edits will often go through (but not always), however once it stops working, it'll never work again until the page has been refreshed (but usually it requires the whole application to be reset). It's been very hard to pin down because no errors are getting thrown in either javascript or asp.net.

We are using a custom template for editing, but I have eliminated this as a possible culprit, because the problem occurs exactly in the same way if I change the edit type to InCell or InLine.

Here is the code:

    @(Html.Kendo().Grid<AttorneyRequestPendingDeterminationViewModel>()
          .Name("PendingDeterminationGrid")
          .DataSource(dataSource => dataSource
              .Ajax()
              .Events(events => events.Error("onError"))
              .Read(read => read.Action("Read", "PendingDetermination").Data("getSearchData"))
              .Model(model => model.Id(p => p.Id))
              .Update(read => read.Action("DecisionsEdit", "PendingDetermination"))
              .Update(read => read.Type(HttpVerbs.Post))
              .PageSize(20)
              .Events(events => events.RequestEnd("onRequestEnd"))
          )
          .Columns(columns =>
          {
              columns.Bound(m => m.DateEntered).Title("Date Entered");
              columns.Bound(m => m.LocalId).Title("Local ID");
              columns.Bound(m => m.DefendantName).Title("Name");
              columns.Bound(m => m.Offense).Title("Offense");
              columns.Bound(m => m.EnteredBy).Title("FQ User ID");
              columns.Bound(m => m.InterviewLocation).Title("Interview Location");
              columns.Bound(m => m.CourtLocation).Title("Court Location");
              columns.Bound(m => m.Recommendation).Title("Recommendation");
              columns.Command(m => m.Edit()).Title("Actions");
          })
          .Editable(edit => edit.Mode(GridEditMode.PopUp).TemplateName("DecisionsTemplate"))
              .Sortable(sortable => sortable
                .Enabled(true)
                .AllowUnsort(false)
                .SortMode(GridSortMode.SingleColumn))
              .Groupable()
              .Pageable()
          .Deferred()
          )

<script type="text/javascript">
    require(['/Content/js/config.js'], function() {
        require(['jquery', 'lib/kendo/kendo.grid.min', 'lib/kendo/kendo.aspnetmvc.min'], function($, kendogrid, kendomvc) {
            @Html.Kendo().DeferredScriptsFor("PendingDeterminationGrid", false)

            function onRequestEnd(e) {
                if (e.type == "update") {
                    location.reload();
                }
            }

            $(".k-link").bind("click", function(e) {
                $('#grid').data('kendoGrid').dataSource.page(1);
            });

            $('#SearchString').keyup(function(event) {
                if (event.keyCode == 13) {
                    $('#SearchButton').click();
                }
            });

            $("#SearchButton").click(
                function() {
                    $('#grid').data('kendoGrid').dataSource.fetch();
                    $('#grid').data('kendoGrid').dataSource.page(1);
                });

            function getSearchData() {
                return {
                    SearchString: $("#SearchString").val(),
                    SearchTypeSelected: $("#SearchTypeSelected").val(),
                };
            };
        });
    });
</script>


And the controller method in case you need it:

[HttpPost]
        public ActionResult DecisionsEdit([DataSourceRequest] DataSourceRequest request,
            AttorneyRequestPendingDeterminationViewModel attorneyRequest)
        {
            string href =
                attorneyRequest.Links.FirstOrDefault(l => l.Rel == Constants.Rels.AttorneyRequestDecisions).Href;
            int val;
            if (attorneyRequest.EligibilityOverrideReason != null && int.TryParse(attorneyRequest.EligibilityOverrideReason.Value, out val))
            {
                attorneyRequest.EligibilityOverrideReasonId = val;
            }
            if (attorneyRequest.NotEligibleReason != null && int.TryParse(attorneyRequest.NotEligibleReason.Value, out val))
            {
                attorneyRequest.NotEligibleReasonId = val;
            }


            var response = HalClient.PutAsJsonAsync(href, attorneyRequest).Result;

            if (!response.IsSuccessStatusCode)
            {
                if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    this.Toast(ToastType.Error, "The attorney request could not be located");
                }
                if (response.StatusCode == HttpStatusCode.BadRequest)
                {
                    this.Toast(ToastType.Error, "The attorney request is invalid");
                }
            } else
            {
                this.Toast(ToastType.Success, "The decisions have been updated");
            }
            return Index();
        }

Please let me know if you need any other information to help nail this down.



Alexander Popov
Telerik team
 answered on 12 Mar 2015
1 answer
87 views
בס"ד

hi ,
i'm using kendo 2012.1.419 version.

I need to delay the auto close grid column menu (of the sub filter window) on mouse out.

How can i do it  ? 

Regards,
Moshe Yariv Malka

Kiril Nikolov
Telerik team
 answered on 12 Mar 2015
1 answer
94 views
Hi Telerikains,

I have a grid with 6 columns and filtering active. The last column width is stretched to fill grid. However the filter control is not drawn correctly. Is there anything I can do to fix this?

@(Html.Kendo().Grid<WebUserViewModel>()
       .Name("WebUsersGrid")
       .HtmlAttributes(new { @class = "js-full-height-grid" })
       .Columns(columns =>
       {
           columns.Bound(c => c.Id).Title("").ClientTemplate(Html.BuildWebUserIcons<WebUserViewModel>(this.User, "WebUsersGrid")).Width(StyleValues.Grid.ThreeIconColWidth).Filterable(x => x.Enabled(false)).Sortable(false).HtmlAttributes(new { style = " text-align:center;" });
 
           columns.Bound(c => c.Id).Visible(false);
           columns.Bound(c => c.AccountId).Visible(false);
 
           columns.Bound(c => c.Active)
               .ClientTemplate(Html.ClientTemplate_ActiveImg())
               .Width(100)
               .HtmlAttributes(new { style = " text-align:center;" });
 
           columns.Bound(c => c.UserNameWithinAccount).Title("User Name").Filterable(filterable => filterable.UI("NameFilter")).Width(200);
           columns.Bound(c => c.FirstName).Width(200);
           columns.Bound(c => c.LastName).Width(200);
           columns.Bound(c => c.Email);
       })
       .ToolBar(toolbar =>
       {
           toolbar.Create().Text("Add Web User");
       })
       .Filterable(filterable => filterable
           .Extra(false)
           .Mode(GridFilterMode.Row)
           .Messages(x => x.IsFalse("N"))
           .Messages(x => x.IsTrue("Y"))
           .Operators(operators => operators
               .ForString(str => str.Clear()
                   .Contains("Contains")
                   .DoesNotContain("Does Not Contain")
                   .StartsWith("Starts with")
                   .IsEqualTo("Is equal to")
                   .IsNotEqualTo("Is not equal to")
               )
           )
       )       
       .Scrollable()
       .Sortable()
       .Pageable(pageable => pageable
           .Refresh(true)
           .PageSizes(true)
           .ButtonCount(5)
       )
   )

Thanks,

Paul Ridden
Top achievements
Rank 1
Veteran
 answered on 12 Mar 2015
1 answer
112 views
I have grid with a column bound like this...

cols.Bound(m => m.Location).Filterable(fl => fl.Cell(c => c.Template("locationFilter").Operator("equals").ShowOperators(false)));

and some javascript..

var locationList = [
                        {text: "Atlanta", value: "ATL"},
                        {text: "Houston", value: "HOU"},
        ];
function locationFilter(container) {
            container.element.kendoDropDownList({
                dataTextField: "text",
                dataValueField: "value",
                optionLabel: { text: "-ALL-", value: "" },
                dataSource: { data: locationList, },
            });
        }

This seems to initialize correctly showing '-ALL-' with no filter applied.  But as soon as I select something in the dropdownlist it immediately changes the selection back to "-ALL-" and filters out all the items.

However, if I change it to this and use strings for the data instead of objects, it lets me select items and applies the filters ok but the display isn't optimal...

function locationFilter(container) {
            container.element.kendoDropDownList({
                optionLabel: "-ALL-",
                dataSource: {data: ["ATL", "HOU"],},
            });
        }

Am I doing something wrong when trying to use objects in the datasource for the custom filter, or is there a bug?
Alexander Popov
Telerik team
 answered on 12 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?