Telerik Forums
UI for ASP.NET MVC Forum
1 answer
113 views

I have a partial view that contains a TabStrip and each that contains a grid. The view works, it's currently in a different page and I'd like to move it to a kendo window.

I've moved it to a kendo window and the window displays great.

Here's the code that generates my window (please note the variable names have been changed for this).

var window = $("#window").kendoWindow({
                content: {
                    url: "/Case/CaseDetail",
                    data: {
                        Daid: Daid,
                        CaseID: CaseID,
                        RecordID: RecordID,
                        CanUserView: cuv,
                        OffenseCount: OffenseCount,
                        CoDefendantCount: CoDefendantCount,
                        VWCount: VWCount,
                        InternalProcessCount: InternalProcessCount,
                        ChargeDispositionCount: ChargeDispositionCount,
                        SentenceCount: SentenceCount,
                        OtherCaseCount: OtherCaseCount
                    }
                },
                actions: [
                    "Pin",
                    "Minimize",
                    "Maximize",
                    "Close"
                ],
//                close: onClose
            });
 
            window.kendoWindow().data("kendoWindow").center().open()

 

The window appears and the tabs are visible, the content of the 1st tab is loaded via an AJAX call that is never executed (so no content) and none of the tabs are functional when I click on it.

When I look at the page source I can see that the window was rendered as text and all associated javascript is actual text and not, all the scripts related seem to be escaped, here's an example of some rendered content:

<script type="text/javascript">
    function ProcessErrorO(args) {
        ProcessError(args, 'O_grid_' + '#= RecordID #');
    }
<\/script>

 

Any help would be appreciated.

Thanks

Martin
Telerik team
 answered on 29 Aug 2019
1 answer
543 views

I had a subcription 5 years ago and have decided to renew my subscription to get the latest version of Kendo for MVC. Our code uses bootstrap as well as Kendo, with JQuery. I was expecting to be able to upgrade all of these to their latest versions. However, I notice that the JQuery file used by Kendo is still 1.12.4, but Visual Studio is referenceing 3.4.1 by default. 

Is it possible to ditch 1.12.4 and kendo work with 3.4.1?

 

Nikolay
Telerik team
 answered on 29 Aug 2019
2 answers
140 views

Hello everyone,

It's possible to apply a filter on one field automatically?  When I load the page I want one filter applied without the user have to do it each time.  Of course he can remove it.

 

See attachment.

 

Louis
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 28 Aug 2019
3 answers
632 views

Hello, with my code below I want to populate the dropdown and the grid(with all rows), then if the user makes a selection in the dropdown I want the grid to be refreshed with the filtered rows. The NewPartsRead controller action does return the filtered rows, but the grid does not rebind to the filtered rows returned.

What am I doing wrong?

Index:

 @using (Html.BeginForm())
                {    <div class="demo-section k-content" style="padding:20px;">
                     
                        @(Html.Kendo().DropDownList()
                                                    .Name("EngMake")
                                                    .DataTextField("Text")
                                                    .DataValueField("Value")
                                                    .BindTo(Model.EngMakeList)
                                                    .SelectedIndex(0)
                                                    .OptionLabel("Select Engine Manufacturer")
                                                    .HtmlAttributes(new { style = "width:300px" })
                                                    .Filter(FilterType.Contains)
                        )

 

 

                    </div>

                         @(Html.Kendo().Grid(Model.NewParts)
                                           .Name("grid")
                                           .Columns(columns =>
                                           {
                                               columns.Bound(p => p.EngDescription);
                                               columns.Bound(p => p.PartType);
                                               columns.Bound(p => p.EngYear);
                                               columns.Bound(p => p.EngCylinders);
                                               columns.Bound(p => p.EngBore);
                                               columns.Bound(p => p.PartYears);
                                               columns.Bound(p => p.Partieb);
                                               columns.Bound(p => p.PartNotes);
                                           })
                                           .Pageable()
                                           .Sortable()
                                           .Scrollable()
                                           .Filterable()
                                           .HtmlAttributes(new { style = "height:550px;" })
                                           .DataSource(dataSource => dataSource
                                               .Ajax()
                                               .PageSize(20)
                                               .Read(read => read.Action("Index", "NewPartsRead"))
                                            )
                    )
                }

 

Controller:

  public class NewPartsController : Controller
    {
        // GET: NewParts
        public ActionResult Index()
        {
            var model = new NewPartsModel();
            return View(model);
        }
        [HttpPost]
        public ActionResult NewPartsRead(NewPartsModel newPartsModel)
        {
            newPartsModel.NewParts = newPartsModel.NewPartsRead(newPartsModel.EngMake);

            return Json(newPartsModel.NewParts);
        }
    }

 

Model:

 protected readonly NewPartsProvider newPartsProvider = new NewPartsProvider();

        public string EngMake { get; set; }

        public List<DataObjects.NewPart> NewParts { get; set; }

        public List<SelectListItem> engMakeList = new List<SelectListItem>();

        public IEnumerable<SelectListItem> EngMakeList { get; set; }

        public NewPartsModel()
        {
            foreach (var engMake in newPartsProvider.GetEngMakeList())
                engMakeList.Add(new SelectListItem() { Text = engMake, Value = engMake });

            EngMakeList = engMakeList;
            NewParts = newPartsProvider.GetNewParts();
        }

        public List<DataObjects.NewPart> NewPartsRead(string engMake)
        {
            List<DataObjects.NewPart> NewParts = new List<DataObjects.NewPart>();

            NewParts = newPartsProvider.GetNewPartsByMake(engMake);

            return NewParts;
        }

 

n/a
Top achievements
Rank 1
 answered on 27 Aug 2019
1 answer
102 views

Hello,

@(Html.Kendo().Grid<Myproject.Areas.Maintenance.ViewModels.EquipementsInterventions.EquipementInterventionModel>()
            .Name("EquipementIntervention")
            .Columns(columns =>
            {
                columns.Bound(p => p.NoReference).Width(60);
                columns.Bound(p => p.DateIntervention).Format("{0:yyyy-MM-dd}").Width(60).HtmlAttributes(new { style = "text-align:center" });
            })
            .ToolBar(toolBar =>
            {
                toolBar.Create();
                toolBar.Save();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .HtmlAttributes(new { style = "font-size:11px;height: 300px;" })
            .Scrollable()
            .Selectable(s => s.Enabled(false))
            .Pageable(pageable => pageable
            .Refresh(true)
            .ButtonCount(5))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .PageSize(100)
                .Model(model =>
                {
                    model.Id(field => field.NoEquipementIntervention);
                    model.Field(field => field.NoReference).DefaultValue("Test");
                    model.Field(field => field.DateIntervention).DefaultValue(System.DateTime.Now);
                })
                .Read(read => read.Action("Read", "Equipements", new { id = Model.EquipementId }))
                .Create(create => create.Action("Create", "Equipements", new { id = Model.EquipementId }))
                .Update(update => update.Action("Update", "Equipements"))
                .Destroy(destroy => destroy.Action("Destroy", "Equipements"))
            )
)

I try to set a default value when I add a new item in my grid.  Even with a hard coded value like "Test".  I have the same situation with a DateTime? field until I remove the ?.  Any idea about the NoReference (string) field?

The model :

[Key]
public Guid NoId { get; set; }
 
[Required]
 
public string NoReference { get; set; }
 
[UIHint("Date")]
[Required]
public DateTime DateIntervention { get; set; }

 

The Grid :

 

 

THANK A LOT TO EVERYONE.

 

 

 

Viktor Tachev
Telerik team
 answered on 27 Aug 2019
1 answer
404 views

Hello, I was wondering if it was possible to to the use DateRangePicker for selecting a range of months instead of days. I currently have the following code:

@(Html.Kendo().DateRangePicker()
                                  .Name("MonthlyDatePicker")
                                  .HtmlAttributes(new { style = "width: 100%" })
                                  .Events(e => e.Change("onMonthlyChange"))
                                  .Start("year")
                                  .Depth("year")
                                  .Format("MM yyyy")
                                )

 

This code appears the way I want it to but does not allow the user to select a month. Any help is much appreciated. Thanks

 

Viktor Tachev
Telerik team
 answered on 27 Aug 2019
1 answer
991 views

Hi,

How do we set the series colours on an AJAX MVC Bar chart.

there is an option to set the colors but doesnt seem to matter what is entered nothing works

@(Html.Kendo().Chart<CML.Models.TopRequestersSample_Result>()
    .Name("TopRequesters")
    .SeriesColors()
    .Title("Top 10 Requesters by Sample Count")
    .Legend(legend => legend.Position(ChartLegendPosition.Bottom))
    .DataSource(ds => ds.Read(read => read.Action( "GetTopRequesters","Dash" ) ))
    .Series( s => { s.Bar( a => a.Total ); } )
    .CategoryAxis(ca => {
        ca
   .Categories( a => a.DisplayName )
   .Name( "Requester" );
    })

 

Nikolay
Telerik team
 answered on 23 Aug 2019
3 answers
337 views

I used the solution (slightly modified for my use case) referenced in the docs to add a new row when tabbing out of the last editable column in the last row. However, when the new row is added, the changes made to that last editable cell are lost. How do I prevent that from happening?

Here's my code. The "return false;" was necessary to prevent the focus going to the second column of the new row. The undesired behavior is occurring whether or not I include it.

$(document).ready(function () {
    var grid = $("#ReceivingReportGrid").data("kendoGrid");
 
    grid.tbody.on("keydown", function (e) {
        if (e.keyCode == 9) {
            if ($(e.target).closest('td').is(':nth-last-child(2)') && $(e.target).closest('tr').is(':last-child')) {
                grid.addRow();
                return false;
            }
        }
    });
});
Georgi
Telerik team
 answered on 23 Aug 2019
1 answer
109 views

I have 2 comboBox(s) on a grid.  When the user clicks the edit button, I want the values that are in the comboBox to stay, currently they blank out.  Why is it doing this, and what's the simple solution.

 

 

Alex Hajigeorgieva
Telerik team
 answered on 22 Aug 2019
4 answers
1.0K+ views
If I create and then immediately update, it will not have ID and treat the update as new insert and will show error message of "javascript runtime error: unable to get property 'ID' of undefined or null reference."

If I create and then immediately delete, same error message and it will not delete the data as it has no new inserted id.

But I can update or delete if the grid is refreshed by refreshing the web page.  What did I miss?

​ <%: Html.Kendo().Grid<zProvince>()
.Name("GridProvince")
.Columns(columns =>
{
columns.Bound(o => o.ProvinceName).Title("Name");
columns.Bound(o => o.empgroupName).Title("empgroupName");
columns.Bound(o => o.ID).Hidden();
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
})
.ToolBar(commands => commands.Create())
.Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("GetProvince", "Admin"))
.Create(create => create.Action("CreateProvince", "Admin"))
.Update(update => update.Action("UpdateProvince", "Admin"))
.Destroy(destroy => destroy.Action("DestroyProvince", "Admin"))
)
.Events(events => events
.Change("change"))
.Selectable(s => s.Mode(Kendo.Mvc.UI.GridSelectionMode.Single))
.Scrollable()
.Pageable()
%>
Alex Hajigeorgieva
Telerik team
 answered on 22 Aug 2019
Narrow your results
Selected tags
Tags
+133 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
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
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?