Telerik Forums
UI for ASP.NET MVC Forum
3 answers
1.2K+ views
Hi everyone,
I have a grid with a DateTime inside, I want to modify it with inCell editing.

This is my grid definition:

@(Html.Kendo().Grid(Model.row)
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(l => l.LRId).Hidden();
        columns.Bound(l => l.StartDate).Format("{0:d}");
        columns.Bound(l => l.Amount);
 
        columns.Command(command => command.Custom("logicalDelete"));//.Click("udmAltDelete"));
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(ed => ed.Mode(GridEditMode.InCell))
    .DataSource(ds => ds
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Model(model =>
        {
            model.Id(l => l.LRId);
        })
        )
)

When the grid show data correctly formatted with "Short date format" (look image attached: View.png),
but when i modify the date the grid modify the format (look image attached: Modify.png).

How can I have the same format for view and editing data?
Viktor Tachev
Telerik team
 answered on 02 May 2017
4 answers
198 views
I followed the ajax editting docs and I have server side validation error correctly getting displayed.  But the grid action still completes and the grid reverts back to view mode instead of staying in edit mode so I can correct the errors.

How do I get the grid to not update itself?
Boyan Dimitrov
Telerik team
 answered on 02 May 2017
1 answer
143 views

Hi,

I am trying to retain the edit mode of the cell in the Gantt Chart when the modelState has errors. 

<script>

function error(e) {
            var grid = $("#gantt").data("kendoGantt");
            grid.one("dataBinding", function(args) {
                e.preventDefault();
            });
            if (e.errors) {
                var msg = "";
                $.each(e.errors, function(key, value) {
                    if (value.hasOwnProperty("errors")) {
                        $.each(value.errors, function() {
                            msg += this + "<br />";
                        });
                    }
                });

             alert(msg);
            }
        }

</script>

 

@(Html.Kendo().Gantt<TaskGantt, TaskGanttDependency>()
    .Name("gantt")
    .DataSource(ds => ds
                        .Read(read => read
                            .Action("Tasks", "Home")
                        )
                        .Update(update => update
                            .Action("Update", "Home")
                        )
                        .Events(events => events
                          .Error("error")
                        )
                        .Model(m =>
                        {
                            m.Id(f => f.Id);
                            m.ParentId(f => f.ParentId);
                            m.OrderId(f => f.OrderId);
                            m.Field(f => f.Expanded).DefaultValue(true);
                        })
                    )
                    .DependenciesDataSource(ds => ds
                        .Read(read => read
                            .Action("Dependencies", "Home")
                        )
                        .Model(m =>
                        {
                            m.Id(f => f.DependencyId);
                            m.PredecessorId(f => f.PredecessorId);
                            m.SuccessorId(f => f.SuccessorId);
                            m.Type(f => f.Type);
                        })
                    )
                    
    .Columns(columns =>
    {
        columns.Bound("title").Editable(true).Sortable(true);
        columns.Bound("end").Title("End Time").Format("{0:MM/dd/yyyy}").Width(100).Editable(true).Sortable(true);  
    })
    .Views(views =>
    {
        views.WeekView(weekView => weekView.Selected(true));
        views.MonthView();
    })
    .Events(events=> events
        .DataBound("onDataBound")
    )
    .Height(500)
    .ShowWorkHours(false)
    .ShowWorkDays(false)
    .Snap(false)
    .Resizable(true)
    )

I have used the above code, but i am not able to retain the edit mode for a single cell when the ModelState has errors.I have attached the image of how the gantt chart should look after update is called and ModelState returns error.

Can i get to know if I have missed any thing or any other approach is there to carry on with the requirement.

 

Thanks

Dimitar
Telerik team
 answered on 02 May 2017
3 answers
131 views

Hi,

I want to ask if there is a way to set up kendo work offline mode with foreign key dropdown in asp.net mvc? 

I checked the demo for kendo work offline, but that demo is so simple with data structure, I wonder if someone can provide a work offline example that works with one or two foreign key dropdown column.

Thanks,

Ricky

Stefan
Telerik team
 answered on 01 May 2017
1 answer
366 views

I have a grid where I'm dynamically setting the columns at run time. However, I've come into a problem as the grid fails to show any data when the record set is quite large, in this case, 49K rows.

 

Has anyone else tried a similar approach with success?

Konstantin Dikov
Telerik team
 answered on 28 Apr 2017
4 answers
433 views

Using the most recent version of the trial for MVC UI and I'm unable to get some important features working, for example the gird filter ROW option and the Excel file export.  

Please advise should I have all features enabled in the trial and if not, how can I evaluate properly?

For example for both of these I get errors (Excel shown). When I take out the offending line it's all good.

   
        .Excel(excel => excel
        .FileName("Customer List.xlsx")
         )

     

Compilation ErrorDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1061: 'Kendo.Mvc.UI.Fluent.GridBuilder<KendoUI.Sasco.Dashboard.Models.CustomerViewModel>' does not contain a definition for 'Excel' and no extension method 'Excel' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.GridBuilder<KendoUI.Sasco.Dashboard.Models.CustomerViewModel>' could be found (are you missing a using directive or an assembly reference?)

If I refer to the kendo.mvc.dll in the distribution folder I get a license error - the reference that exists is to the example/sample folder that I downloaded.

Boyan Dimitrov
Telerik team
 answered on 28 Apr 2017
1 answer
403 views

Using Grid with MVC works fine, but unless I missed it, there does not seem to be many choices for formatting such as bold text, resizing/larger text;  And When using MVC to make a simple table, I had used the html action link so that clicking on an item takes the browser to a specific page.  Is this not supported in Grid?

for example, using this kind of html:   <td style="font-size: larger; font-weight: 700;">@Html.ActionLink("Click here to go to the page",  "index", "/home/index")</td>

If not, is there another kind of Grid item available that does?

 

Thanks

Tsvetina
Telerik team
 answered on 28 Apr 2017
2 answers
1.3K+ views
See the page screen shot.

I would like to pass the values in the textbox and two calendar controls to the controller using the .read action in the datasource.

One way I read about is using hidden HTML which I tried but the grid doesn't like it, at least the way I did it. I tried many ways.

When I hard code the values in the .read action, it does work and return the correct results. It's now just parameterizing it that is giving the problem.

@Html.Hidden("txtPartNum", "S2G-120");
@Html.Hidden("dtDateto", "2015-01-01");
@Html.Hidden("dtDatefrom", "2015-05-02");

Please advise the recommended method to retreive the values of the controls and pass to the backend please.

@(Html.Kendo().Grid<KendoUI.Sasco.Dashboard.Models.PartsHistoryViewModel>()
      .Name("PartsHistory")
      .HtmlAttributes(new { style = "height: 800px; border: 0;" })
      .Columns(columns =>
      {
          //columns.Bound(c => c.Part_Number).HeaderTemplate("<div><label for='PartNum'>Part Number</label> <input type='text' id='PartNum'/></div>");
          columns.Bound(c => c.Month);
          columns.Bound(c => c.SalesVolume).Title("Sales Volume");
          columns.Bound(c => c.SalesAmount).Title("Sales Amount").Format("{0:c0}");
          columns.Bound(c => c.Unit).Hidden();
          columns.Bound(c => c.PPH).Title("Price per 100");
      })
     .ToolBar(toolbar => {
         toolbar.Excel();
         toolbar.Pdf();
     })
      .Selectable()
      .Scrollable()
      .Pageable()
      .Events(e => e
      .DataBound ("onDataBound") //not needed unless something to pop open
     )
      .Navigatable()
      //.Filterable(filterable => filterable.Mode(GridFilterMode.Row))
      .DataSource(dataSource => dataSource
      .Ajax()
      .PageSize(20)
            //   .Read(  "PartsHistory", "PartsHistory" )  
            //          .Read(read => read.Action("PartsHistory", "PartsHistory", new { pPartName = "S2G-120", pStartDate = "2015-03-01", pEndDate = "2017-02-01"}))
            .Read(read => read.Action("PartsHistory", "PartsHistory", new { pPartName = txtPartnum.val() , pStartDate = txtDatefrom.val() , pEndDate = txtdateto.val() }))

Thanks much!
Larry
Top achievements
Rank 1
 answered on 27 Apr 2017
3 answers
191 views

Hi,

Was wondering if there is a Loader like the combobox, that could be displayed over the spinner part, while an Ajax call is made to fill in this field.

I thought that the following would work
kendo.ui.progress($("#txtNumericValueField"), true);

Dimiter Topalov
Telerik team
 answered on 27 Apr 2017
2 answers
463 views

Hi,

I have the following code in my controller and in the mapping of my entity I navigate a foreign key. (Plate = anomalie.voiture.plaque)

That gives me the following exception:

An exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.dll but was not handled in user code

 

There is already an open DataReader associated with this Connection which must be closed first.

 

I tried to add an include() but doesn't solve the problem. Any ideas ?

public ActionResult Read([DataSourceRequest]DataSourceRequest request)
{
    using (var context = new carpackEntities())
    {
        IQueryable<anomalie> damages = context.anomalie;
        damages.Include(d => d.voiture);
        var result = Json(damages.ToDataSourceResult(request, damage =>
        new DamageViewModel()
        {
            Date = damage.dtajout,
            Description = damage.avarie,
            Driver = damage.chauffeur,
            Plate = damage.voiture.plaque,
            Service = damage.service,
            State = damage.etat.ToString()
        }));
        return result;
    }
}
Emmanuel
Top achievements
Rank 1
 answered on 26 Apr 2017
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?