Telerik Forums
UI for ASP.NET MVC Forum
3 answers
173 views
All,

Is it possible to have a time picker with more than one column? My time selection can run all day, normally at 30-minute intervals and I would hate to have to scroll down like that. With the asp.NET version there is a property I can set, but not so here. I imagine it would be done with templating, but I am not sure how that would work.
I have the following definition:

 <label for="TxtCloseTime">Close:</label>
                            @(Html.Kendo().TimePicker().Name("TxtCloseTime")
                 .Events(e => e.Change("VerifySelection"))
                .Interval(30)
                .Animation(a => a.Open(o => o.Expand(ExpandDirection.Vertical))))

Thanks,

Sean~
Kiril Nikolov
Telerik team
 answered on 09 Jun 2014
1 answer
120 views
My UI folks don't like the initial view of the Upload control with just the two offset "Select File" and "Upload File" buttons offset on a blank background.  They would prefer that the file grid shows all the time from the beginning.  So even before a file is selected, an empty row in the grid would be preferable.  What is the simplest way to do this?   Is there a Display attribute for "tr.t-no-data" class to accomplish this?

Thanks!
-Bob
Dimiter Madjarov
Telerik team
 answered on 09 Jun 2014
1 answer
555 views
I am not able to use kendo.data.datasource and also not kendogrid.datasource
Kiril Nikolov
Telerik team
 answered on 06 Jun 2014
1 answer
608 views
When a user changes the order of columns in a grid, I was able to capture the new column order, serialize it, and store it.
I just can't figure out how to bring that data back and re-apply it to the grid when the page reloads.

I used the "columReorder"  event to post a service call to store the results.
 columnReorder: function (e) {
                var that = this;
                setTimeout(function () {
                    SaveColsGrid1(kendo.stringify(that.columns));
                }, 5);
            },

I've tried a couple ways to bring in columns.
I tried binding to kindo grid "columns" property, but an external web service call doesn't come back in time before the grid renders.
Am I going about this correctly or is there a better way to take a serialized list of columns (that i've saved) and set the order when the grid loads?

Thanks,
Ben
Dimo
Telerik team
 answered on 06 Jun 2014
2 answers
783 views
I have a People View that shows People in a Grid and each one has a standard Edit button.

(Guest)Index View
@model IEnumerable<PersonModelBase>
@using Kendo.Mvc.UI
@using SIS.Entities
@using SIS.Web.Models
...
    @(Html.Kendo().Grid<PersonModel>()
        .Name("peopleGrid")
        .Columns(columns =>
        {
            columns.Bound(p => p.ID).Hidden();
            columns.Bound(p => p.FullName)
                .HeaderTemplate("Name <input type='text' id='fullname' />")
                .Width(230);
            columns.Bound(p => p.DOB)
                .Format("{0: yyyy-MM-dd}")
                .HeaderTemplate("Date of Birth");
            // Define command columns
            columns.Command(commands =>
            {
                commands.Edit();
            })
                .Width(100);
        })
        //.Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Editable(editable => editable
            .Mode(GridEditMode.PopUp)
            .DisplayDeleteConfirmation(true)
            .TemplateName("_AddEditPerson"))

The Edit button goes to the _AddEditPerson Partial View.  The PersonModel is successfully passed through with properties within the Model being displayed, including the ID (for debug purposes).

_AddEditPerson Partial View 
@model SIS.Web.Models.PersonModel
@using SIS.Web.Models
@using Kendo.Mvc.UI

display of ID from Model works fine

                @* ID *@
                <div class="form-group">
                    <label for="ID" class="col-sm-2 control-label">ID</label>
                    <div class="col-sm-10">
                        @Html.EditorFor(model => model.ID)
                    </div>
                </div>

but use of Model to pass through to Grid in TabStrip View does not

        @(Html.Kendo().TabStrip()
                    .Name("bottom-tabstrip")
                    .Items(tabstrip =>
                    {
                        tabstrip.Add().Text("Notes")
                            .Selected(true)
                            .Content(
                            @<text>
                                <div id="notesGrid" class="form-horizontal">
                                    @*ToDo*@
                                    @Html.Partial("Partials/_NotesGrid", Model.ID)
                                </div>
                            </text>);

The _AddEditPerson Partial View then calls some other partial views (e.g. see below) to show Grids for that Person within various tabs.

The issue is that when I try to pass through the ID (of the Person) through to those partials so that they can list items for that person, its null.  In fact the whole Model can be seen to be Null when I debug it.  If I hard card the ID being passed through it works, so its not an issue in getting it from the AddEdit to the Partial but in using model data for passing through.

What am I missing?

Thanks,

Chris.

_NotesGrid View
@model int
@using Kendo.Mvc.UI
@using ShilohIS.Web.Models

@(Html.Kendo().Grid<NoteModel>()
    .Name("notesgrid")
...
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("ReadRegarding", "Notes", new { id = Model }))
        .Create(create => create.Action("Create", "Notes"))
        .Update(update => update.Action(/* action */"Update", /* controller */ "Notes"))
        .Model(model =>
            {
                model.Id(note => note.ID);
                // Guest id
                model.Field(note => note.RegardingID).DefaultValue(Model);
                // Status
                model.Field(note => note.Status).DefaultValue(new SelectListItem());



Chris
Top achievements
Rank 1
 answered on 05 Jun 2014
3 answers
104 views
Is there a way to reference the toolbar from the Events function in order to change the text content of the toolbar?

Dan
Dimiter Madjarov
Telerik team
 answered on 05 Jun 2014
1 answer
71 views
Hi

i want to display a link in Grid field. now i have a IsReady Bool field in Model, on Grid read action model fetch with values.

now if this field is true then i want to show this link or if false then i want to hide it.
i want to use razor condition like this is @(IsReady) ? Style:" "  : Style: "display:none" but i can't use because there is "" ' ' error in kendo grid so can any one guide me .

my code is "<a href='' #= @("#=IsReady#").ToString().ToLower() ? 'style=\"display:none;\"' : '' #>link</a>"

Regards,
vinit
Krunal
Top achievements
Rank 1
 answered on 05 Jun 2014
2 answers
223 views
Hi,

I have an error on returning popup kendo window in javascript call from controller in kendo upload.

The scenario is I have a kendo window main popup where inside of it is kendo upload control.
during processing of uploading and validation of excel file, Im creating error list gathered from excel data
and returning all that lists as popup kendo window from controller (javascript call).

The problem is, the popup kendo window with the list of string is not functioning but returning as javascript file to upload.
I don't know what's the conflict between the main kendo window, kendo upload and the new kendo window that I called as error list window which
is not popping-up.

See my code below...

VIEW:


<script>
    

    $(document).ready(function () {
        var iProcess = true;

        var dialog = $("#ImportDetails").data("kendoWindow");
        dialog.center();

        $("#btnImportCancel").kendoButton({
            click: function (e) {
                dialog.close();
            }
        });

        var lookup = $("#ComboLookupTable").data("kendoComboBox");
      
        $("#files").kendoUpload({
            async: {
                saveUrl: "Lookup/UploadFile",
                removeUrl: "remove",
                autoUpload: false,
                value: 'Import'
            },
            localization: {
                select: "Select a file",
                uploadSelectedFiles: "Import"
            },
            multiple: false,
            select: function (e) {
                var kendoWindow = $("<div />").kendoWindow({
                    title: "Replace Lookup Table Data?",
                    height: 130,
                    width: 280,
                    resizable: false,
                    modal: true,
                    animation: {
                        open: {
                            effects: "fade:in",
                            duration: 500
                        },
                        close: {
                            effects: "slide:right fadeOut",
                            duration: 500
                        }
                    },
                    visible: false
                });

                kendoWindow.data("kendoWindow")
                    .content($("#delete-confirmation").html())
                    .center().open();

                kendoWindow
                    .find(".delete-confirm,.delete-cancel")
                        .click(function () {
                            if ($(this).hasClass("delete-cancel")) {
                                iProcess = false;
                                e.preventDefault();
                                kendoWindow.data("kendoWindow").close();
                                dialog.close();
                            }
                            else {
                                kendoWindow.data("kendoWindow").close();
                            }
                        })
            },
            upload: function (e) {
                 e.data = { additional: $("#ComboLookupTable").val() };
            },
            success: function (e) {
                var delay = 1500;
                setTimeout(function () {
                    e.preventDefault();
                    dialog.close();
                }, delay);
            },
            error: function (e) {
               
                var err = e.XMLHttpRequest.responseText;
                alert(err);
            }

        });
    });


function showErrorMsgsJson(messages, windowName) {
    showErrorMsgs($.parseJSON(messages), windowName);
}

function showErrorMsgs(messages, windowName) {
    var results = "";
    if (messages.length > 0) {
        results += "<ul class='list-group'>";
        $.each(messages, function (i, n) {
            //results += "<span>" + (i + 1) + ". " + n + "</span><br/>";
            results += "<li class='list-group-item'>" + (i + 1) + ". " + n + "</li>";
        });
        results += "</ul>";

        var formattedMessages = '<div style="height:305px; margin: 2px 2px 15px 2px; padding: 10px 10px; border:1px solid lightgray; ">' + results + '</div>'
        var closeButton =
            '<div style="text-align:center;">' +
            '    <button id="btnCloseMessages" type="button" class="k-button" onclick="closeWindow(\'' + windowDialog + '\');">&nbsp;&nbsp;Close&nbsp;&nbsp;</button>' +
            '</div>';

        $("#" + windowName).data(kendoWindow).content(formattedMessages + closeButton).center().open();
    }
}


</script>

from my CONTROLLER:


 <HttpPost>
    Public Function UploadFile(ByVal files As HttpPostedFileBase, ByVal additional As String) As ActionResult

        Dim data = (New ExcelReader()).ReadExcel(files)

       
                For Each datarow In data.DataRows
                    ent.Add(New ViewModel.FuelEfficiencyViewModel.Create With {.VehicleClass = datarow(0).ToString, _
                                                                               .FuelEfficiencyValue = If(datarow(1) <> Nothing, Convert.ToDecimal(datarow(1)), 0), _
                                                                               .CreatedBy = Session(LocalConstant.Ses_UserID), _
                                                                               .CreatedDate = Now.Date})
                Next

                'Validation here
                Dim _messages As List(Of String) = _fuelefficiencyRepository.ValidateEntity(ent)

                If _messages.Count = 0 Then
                    _fuelefficiencyRepository.Create(ent)
                    Return Content("")
                Else
                    'THIS IS WHERE THE ERROR OCCUR, new kendo window dialog is not popping-up but js file is occuring.
                      Return JavaScript("showErrorMsgsJson('" & _messages.ToJSON() & "','windowDialog')")
                    'NOTE, showGridErrorMsgs is javascript function to call new popup kendo window, see code above
                End If

    End Function
    
    
    
    I hope you could help me on this to pop-up new kendo window. See attached error image.



Dimiter Madjarov
Telerik team
 answered on 05 Jun 2014
1 answer
177 views
Hi

I am attempted to work with a treeview and it is not going very well.  I am using Datasource property to get the nodes of the treeview which works.  I want to be able to set the ImageUrl of the nodes.  This is something that I have been able to do in the past using BindTo and mapping the appropriate fields.

Is there some way to use the Datasource and set up a property mapping?  Unless I'm missing something, it seems like you are pretty limited with what you can do as far as setting any node properties other than the text using the Datasource.

Any help would be appreciated.
Alex Gyoshev
Telerik team
 answered on 05 Jun 2014
1 answer
297 views
Hello!
Tell me please. Can I add a layer with gps track on the map? Thank you!
T. Tsonev
Telerik team
 answered on 04 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?