Telerik Forums
UI for ASP.NET MVC Forum
3 answers
109 views

I want to be able to use Defined Name when creating my spreadsheet so that I can use them in formulas.  IE instead of having to create a formula that is

= SUM(A1:A20)   I define A1 to A20 a name "Period1" and then I can do things like = SUM(Period1 Apples)  etc.  How do you create the Defined Names in the Spreadsheet and does the formulas then support this feature.  Also when exporting the spreadsheet to excel do the formulas and names export?

Thanks

Lee

T. Tsonev
Telerik team
 answered on 23 May 2016
1 answer
347 views

Hi, i found an example of a Multiselect with checkbox on item templatem unfortunately only with UI syntax  and tried to use that in

MultiSelectFor in MVC but struggle with the item template. Can somebody help me please ?

Knowlege Article from UI

http://www.kendoui.io/kendo-ui/web/multiselect/how-to/checkbox-item-template#create-checkbox-custom-item-template

 

Here is my code for the editor template

@(
 Html.Kendo().MultiSelectFor(m => m)
        .DataTextField("Value")
        .DataValueField("Key")
        .ItemTemplate("<input type='checkbox'/> #:data.text#")
        .TagMode(TagMode.Single)
        .BindTo((System.Collections.IEnumerable)ViewData["FsrList"])
)

 

Georgi Krustev
Telerik team
 answered on 23 May 2016
3 answers
53 views

Hi!

I found a sample that features a grid working with API calls to edit a collection type object. It also shows that the three drop-downs on the grid are cascade-locked with each other. However, the sample was seriously dated and had an issue that the cell were displaying values instead of name even though the editor templates were defined properly. I have upgraded the sample to the very latest Kendo MVC and the behavior is still there and i'm not able to track it to the source. I'm following this example to create a solution to handle similar situation that I've been asking around for quite sometime now: http://stackoverflow.com/questions/37246701/simple-kendo-grid-to-represent-a-listbasicviewmodel-with-add-edit-and-delete

Kindly inform me why the dropdowns are not taking the DisplayText

P.S.: I didn't use NuGet to add commercial Kendo so I have deleted the CSS and JS related to Kendo. You'll have to paste in manually from you own licence.

Shafi
Top achievements
Rank 1
 answered on 22 May 2016
4 answers
796 views

I have a Kendo grid which represents some documents, each row is a document, i need to upload a pdf which is a digitalized copy of the physical document. All rows need  to be save as a List in the server so i'm using a template like this

.ClientTemplate("#= OficioId #<input type='hidden' name='OficioAban[#= index(data) #].OficioId' value='#= OficioId #'/>");    

All fields are working ok but the upload.

i'm trying to save the file in a HttpPostedFileBase which is part of OficioAban Class but this template is not working.

This is the Grid

@(Html.Kendo().Grid<RecintoFiscal.Models.OficioAban>(Model.OficioAban).Name("OficioAban")
                                                .DataSource(datasource => datasource
                                                    .Ajax()
                                                    .ServerOperation(false)
                                                    .Events(events => events.Error("error_handler"))
                                                    .Model(model =>
                                                    {
                                                        model.Id(t => t.OficioId);
                                                        model.Field(t => t.OficioId).Editable(false);
                                                        model.Field(t => t.Usuario).Editable(false);
                                                    })
                                                )
                                                .Events(e => e.Edit("onEdit"))
                                                .EnableCustomBinding(true)
                                                .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
                                                .Navigatable()
                                                .Scrollable()
                                                .TableHtmlAttributes(new { @class = "table" })
                                                .ToolBar(commands =>
                                                {
                                                    commands.Create().Text("Nuevo");
                                                })
                                                .Columns(columns =>
                                                    {
                                                        columns.Bound(o => o.OficioId).Hidden().ClientTemplate("#= OficioId #<input type='hidden' name='OficioAban[#= index(data) #].OficioId' value='#= OficioId #'/>");
                                                        columns.Bound(o => o.NumeroOficio).ClientTemplate("#= getValue(NumeroOficio) #<input type='hidden' name='OficioAban[#= index(data) #].NumeroOficio' value='#= NumeroOficio #'/>");
                                                        columns.Bound(o => o.FechaOficio).ClientTemplate("#= getDate(FechaOficio) #<input type='hidden' name='OficioAban[#= index(data) #].FechaOficio' value='#= getDate(FechaOficio) #'/>");
                                                        columns.Bound(o => o.TipoOficioId).ClientTemplate("#= getTipoOficioText(TipoOficioId) #<input type='hidden' name='OficioAban[#= index(data) #].TipoOficioId' value='#= TipoOficioId #'/>").Title("Asunto");
                                                        columns.Bound(o => o.TipoManiobraId).ClientTemplate("#= getManiobraText(TipoManiobraId) #<input type='hidden' name='OficioAban[#= index(data) #].TipoManiobraId' value='#= TipoManiobraId #'/>").Title("Maniobra");
                                                        columns.Bound(o => o.Remanejos).ClientTemplate("#= getValue(Remanejos) #<input type='hidden' name='OficioAban[#= index(data) #].Remanejos' value='#= Remanejos #'/>");
                                                        columns.Bound(o => o.FechaMovimiento).ClientTemplate("#= getDate(FechaMovimiento) #<input type='hidden' name='OficioAban[#= index(data) #].FechaMovimiento' value='#= getDate(FechaMovimiento) #'/>");
                                                        columns.Bound(o => o.Pedimento).ClientTemplate("#= getValue(Pedimento) #<input type='hidden' name='OficioAban[#= index(data) #].Pedimento' value='#= Pedimento #'/>");
                                                        columns.Bound(o => o.Documento).Width(180).ClientTemplate("#= getValue(Documento) #<input type='hidden' name='OficioAban[#= index(data) #].Documento' value='#= Documento #'/>");
                                                        columns.Bound(o => o.Archivo).ClientTemplate("<input type='hidden' name='OficioAban[#= index(data) #].Archivo'/>");
                                                        columns.Bound(o => o.Liberacion).ClientTemplate("#= Liberacion ? 'Si' : 'No' #<input type='hidden' name='OficioAban[#= index(data) #].Liberacion' value='#= Liberacion #'/>");
                                                        columns.Bound(o => o.Usuario).ClientTemplate("#= getUser(Usuario) #<input type='hidden' name='OficioAban[#= index(data) #].Usuario' value='#= Usuario #'/>");
                                                        columns.Command(command => command.Destroy().Text("Borrar")).Width(95).Title("Acciones");
                                                    })
                                                .Mobile()
                                                .Resizable(resize => resize.Columns(true))
        )

 

and this is my upload file Editor Template

@(Html.Kendo().Upload()
        .Name("Archivo")        
        .ShowFileList(false)
        .HtmlAttributes(new { @class = "form-control filestyle", accept = ".pdf", style = "vertical-align: bottom; padding:0px; margin:0px; border:0px; margin-top:2.5ex;" })
        .Multiple(false)        
)

 

Victor
Top achievements
Rank 1
 answered on 20 May 2016
1 answer
226 views

Hello,

I have a scheduler with timeline view and need to set the row height dynamically. If I set the default height via css the auto expand won't work but if it's not there are to many white space inside the row. Please check image attached to clarify my mind. And is it possible to set alternate row here?

Thank you in advance.

Veselin Tsvetanov
Telerik team
 answered on 20 May 2016
5 answers
526 views

I have MVC5 application and I am using kendo time picker to show time in 12 hr format. The ccorresponding model property is of type TimeSpan. When i submit the chosen time to server, the MVC model binding throws error

The value 'XXX' is not valid for 'PropertyName'.

 

cshtml

@(Html.Kendo().TimePickerFor(x => x.OrderTime)
              .Value("8:00 PM")
              .Min("12:00 AM")
              .Max("11:30 PM")
              .Format("hh:mm tt"))

model

public class MyModel
 {
    public TimeSpan OrderTime {get;set;}
 }

Note that if i remove Format method from the timePicker and submit the time in 24 hr format then i get chosen timespan value on server

Kostadin
Telerik team
 answered on 20 May 2016
1 answer
443 views

I have a popup grid and I am using a template in Shared/EditorTemplates/_TeamSocial.cshtml.
However when the popup opens the TeamID value @Model.TeamID = 0.

How do I get the ID to pass over correctly?

 

Grid code:

@(Html.Kendo().Grid<BusinessApplication.DTO.DTOTeamSocialGrid>().Name("grid")
 
    .Columns(col =>
    {
        col.Bound(m => m.SocialCompanyName);
        col.Bound(m => m.SocialURL);
        col.Bound(m => m.CurrentStatus);
        col.Command(command => { command.Edit().HtmlAttributes(new { @class = "btn" }); }).Width(100);
        col.Command(command => { command.Destroy().HtmlAttributes(new { @class = "btn" }); }).Width(100);
         
    })
        .ToolBar(toolbar => toolbar.Create().Text("Add/Edit social link"))
    .Editable(editable => editable.Mode(GridEditMode.PopUp)
        .TemplateName("_TeamSocial")
        .Window(w => w.Width(600))
        .Window(w =>w.Title("Add/Edit social link")))  
    .Pageable()
    .Sortable()
    .Scrollable(s => s.Height("auto"))
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(m => m.TeamID))
        .Create(update => update.Action("TeamSocial_Create", "Team", new { teamID = Model.TeamID }))
        .Read(read => read.Action("GetTeamSocialGridItems", "Team", new { teamID = Model.TeamID }))
        .Update(update => update.Action("TeamSocial_Update", "Team", new { teamID = Model.TeamID }))
        .Destroy(update => update.Action("TeamSocial_Delete", "Team", new { teamID = Model.TeamID }))
    )
    )
    <script type="text/javascript">
        function error_handler(e) {
            if (e.errors) {
                var message = "Errors:\n";
                $.each(e.errors, function (key, value) {
                    if ('errors' in value) {
                        $.each(value.errors, function () {
                            message += this + "\n";
                        });
                    }
                });
                alert(message);
            }
        }
 
    </script>

 

Template popup code:

@model BusinessApplication.DTO.DTOTeamSocialGrid
 
<!-- Social URL -->
<div class="form-group required  col-xs-10 col-xs-offset-1">
    <span class="pull-right" data-toggle="tooltip"
          title="Enter the social website URL including 'http:// and the username'"
          data-placement="left">
        <i class="fa fa-question-circle"></i>
    </span>
 
    <label for="SocialURL">Social URL</label>
    <input type="text" class="form-control" id="SocialURL" placeholder="Enter the website URL (http://)" name="SocialURL"
           data-fv-notempty="true"
           data-fv-notempty-message="The social URL is required and cannot be empty"
           data-fv-uri="true"
           data-fv-uri-message="The social URL is not valid, it must start with http:// or https://">
</div>
 
<div class="clearfix"> </div>
<div class="form-group  col-xs-10 col-xs-offset-1">
 
 
 
 
    <label class="checkbox">
        <input name="CurrentStatus" type="checkbox" id="CurrentStatus" @if (Model.CurrentStatus == BusinessApplication.Base.PPConstants.CurrentStatus.Active) { @: checked
                                                                                                                                                                                                                                                                                                                                                                           }> Set LIVE
    </label>
</div>
 
 
@Html.Hidden("TeamID", Model.TeamID)
<div class="clearfix"> </div>

 

Thanks 

Tom

Tom
Top achievements
Rank 1
 answered on 20 May 2016
1 answer
650 views

We are using Kendo MVC Grid in our application. We are using LINQ to EF to query the tables.

Following is a query in our application:

query.Where(ExpressionBuilder.Expression<ParentTable>(command.Request.Filters))

This works fine as long as the filters are any columns from the "ParentTable". However, the ParentTable has a navigation collection ICollection<ChildTable> and the ChildTable has a property ChildProperty and the method ExpressionBuilder.Expression fails when we use this ChildProperty for filtering.

Any solution for this problem?

Thanks

T. Tsonev
Telerik team
 answered on 19 May 2016
4 answers
2.5K+ views

Hi guys, currently i have this scenario where i want to get the selected row id after clicking on the edit button and pass that id to the action method...

Please let me know if this is possible. here is my code below that i have gathered so far...

function disableOnEdit(e) {
                      var model = e.model; //gets the model of the currently edited row
                      var Department = model.DepartmentID; //gets the value of the field "Department"
                   
              
                      $.ajax({
                          type: "POST",
                          data: Department,
                          url: '@Url.Action("GetUsers","Home")',
                          success: function (result) {
                              console.log(result);
                          }
                            })
                 
                     
 
                      $(".k-edit-form-container").parent().width(520).height(500).data("kendoWindow").center();
 
                      
                  }

and my grid code below
 
<div  style="clear:both;  position:relative; padding-top: 10px">
@(Html.Kendo().Grid<KendoUIApp1_Test.Models.IncidentsViewModel>()
              .Name("grid")
              .Columns(colums =>
    {
         */
        colums.Bound(p => p.DepartmentID).Hidden(true);
        colums.Bound(p => p.IncidentID).ClientTemplate("<a class='k-button' href='" + Url.Action("GetPDF", "Home") + "?IncidentID=#= IncidentID #'" + "> <span span class='k-icon k-i-pdf''></span>Get Incident Pdf</a>").Title("Download PDF").Filterable(false);
        colums.Bound(p => p.StatusName).Title("Status").Filterable(false);
        colums.Bound(p => p.ReferenceNo).Title("ReferenceNo").Filterable(false);
        colums.Bound(p => p.IncidentDate).Title("IncidentDate").ClientTemplate("#= kendo.format('{0:MM/dd/yyyy HH:mm:ss}',kendo.parseDate(IncidentDate)) #").Filterable(model => model.UI("IncidentDateFilter"));
        colums.Bound(p => p.AccountName).Title("AccountName").Filterable(false);
        colums.Bound(p => p.Department1).Title("Department").Filterable(false);
        colums.Bound(p => p.Description).Title("Description").Filterable(false);
        colums.Bound(p => p.Comments).Title("Comments").Filterable(false);
        colums.Bound(p => p.FirstName).Title("CurrentAssignedUser").Filterable(false);
        colums.Command(cmd => cmd.Edit());
 
    })
      .Filterable(filterable => filterable
        .Extra(true)
        .Operators(operators => operators
            .ForString(str => str.Clear()
                .StartsWith("Starts with")
                .IsEqualTo("Is equal to")
                .IsNotEqualTo("Is not equal to")
 
            ))
        )
 
    .HtmlAttributes(new { style = "height:550px;" })
    .DataSource(datasource => datasource
    .Ajax() //Configure the grid data source
    .Events(Eevents => Eevents.RequestEnd("OnChangeRefresh"))
    .Model(model =>
        {
            model.Id(m => m.IncidentID);
 
 
        })
    .Read(read =>
    {
        read.Action("GetIncidents", "Home").Data("IncidentsFilter");
    })// set the action method which will return the data in json format
 
    .Update(update => update.Action("Incidents_Update", "Home"))
    )
 
    .Navigatable()
    .Groupable()
    .Pageable()
    .Reorderable(reorder => reorder.Columns(true))
    .Sortable()
    .Scrollable()
        .Events(events =>
            {
                events.Save("onIncidentUserAssign");
                // events.Save("onStatusChange");
 
            })
 
            .Events(eEvents => eEvents.Edit("disableOnEdit"))
 
        //.Events(events =>
        //{
        //  events.Save("onStatusChange");
        //   // events.Save("onStatusChange");
 
        //})
 
 
    .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("Incidents")
                                               .Window(w => w.Title("Edit Incident Details")
                                               .HtmlAttributes(new {@class= "kendo-popup-editor" })
                                               .Scrollable(false)
                                               .Name("editWindow")))
                                              
                                                
                                               )

Danail Vasilev
Telerik team
 answered on 19 May 2016
1 answer
102 views

Hello, I'm trying to figure out the scrollbar functionality in Gridbuilder. In my particular case, as shown in the code below, I have a toolbar and some columns. The scrollbar is scrolling the entire grid, header and all. There appears to be another scroll bar for just the data but it is greyed out. What I'm trying to do is just get the data to scroll while leaving the header stationary. Any ideas? 

 

    .Name("Generic")
    .Columns(columns =>
    {
        columns.Bound(p => p.Name);
        columns.Bound(p => p.Desc);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model =>
        {
            model.Id(p => p.ID);
        })
        .Create(create => create.Action("Create")
        .Read(read => read.Action("Read")
        .Update(update => update.Action("Update")
        .Destroy(destroy => destroy.Action("Delete")
        .PageSize(20)
    )
    .Sortable(sortable => sortable
        .AllowUnsort(true)
        .SortMode(GridSortMode.SingleColumn))
    .ToolBar(toolbar =>
    {
        toolbar.Template(@<text>
        @item.CreateButton("Add")
        @item.SaveButton("Save", "Cancel")
        </text>);
    })
)

Scott
Top achievements
Rank 1
 answered on 18 May 2016
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?