Telerik Forums
UI for ASP.NET MVC Forum
11 answers
1.2K+ views

I've been trying to implement cell-based editing into my grid. It does work in a fashion, in that I can edit the current values present in the grid and they do save when clicking the Save Changes button. However, it does not appear to be firing the Update function correctly, which points to a function in the Controller. I know the grid is able to fire events for Read since I've applied a filter which uses a function in the Controller, and it's able to call that function without problems. It just doesn't seem to fire the Update function.

Below is the code for the table;

@{Layout = null;}
 
 
@(Html.Kendo().Grid<FiveSReporting.Models.ViewModels.SchedulingViewModel>()
      .Name("Schedule")
      .Columns(columns =>
      {
          columns.Bound(c => c.LineName);
          columns.Bound(c => c.WeekOfFirst);
          columns.Bound(c => c.WeeksBetweenEach);
      })
      .ToolBar(t => { t.Save(); })
      .Pageable()
      .Editable(e => e.Mode(GridEditMode.InCell))
      .Sortable(sortable =>
      {
          sortable.SortMode(GridSortMode.SingleColumn);
      })
      .Scrollable(scrollable => scrollable.Enabled(false))
      .DataSource(dataSource => dataSource
          .Ajax()
          .Batch(true)
          .ServerOperation(false)
          .Events(e => e.Error("error_handler"))
              .Model(m => { m.Id(s => s.ID); m.Field(s => s.LineName).Editable(false); })
          .Update(update => update.Action("Schedule_Write", "ScheduleAdminTwo"))
          .Read(read => read.Action("Schedule_Read", "ScheduleAdminTwo")
          .Data("getSchedule"))
      )
      .AutoBind(false)
)

 

I've also found that when clicking on the Cancel Changes button that it will throw an error to the console, and subsequent attempts to navigate on the grid also throw errors.This occurs when you click the Cancel Changes button just after clicking the Save Changes button. See attached screenshot for details.

Thank you ahead of time for your assistance.

Denise
Top achievements
Rank 1
 answered on 13 Mar 2018
1 answer
106 views

Hi,I have something like this in my _LayoutStandard.html for an ASP.NET MVC5 site:

@(Html.Kendo().Menu().Name("tdtMenu").Items(lvl1 =>
{
  lvl1.Add()
      .ImageUrl(Url.Content("~/Content/Images/tools.png"))
      .Items(lvl2 =>
      {
          lvl2.Add().Text("Server info").Action("About", "Foo");
          lvl2.Add().Text("Change my password").Action("Manage", "Account");
          lvl2.Add().Text("Administration").Action("Index", "Admin");
          lvl2.Add().Text("Testpages").Items(lvl3 =>
          {
              lvl3.Add().Text("Testpage - Fitting").Action("FittingTest", "Fitting");
              lvl3.Add().Text("Testpage - SignalR").Action("Index", "Foo");
              lvl3.Add().Text("Testpage - Obsolete").Action("Project", "Overview");
          });
          lvl2.Add().Text("Projects").Action("Overview", "Project");
      });
}).Events(e => e.Select("TDT.MenuSelect")))

 

I have noticed, that the Action() calls lead to calling the controller constructors. Why is that? Isn't that a performance issue?

Thank you for more information on this!

Caecilia
Top achievements
Rank 1
 answered on 13 Mar 2018
1 answer
80 views
     Anyone know of a way I can search for a record and programmatically start inline editing a record that might be on another server side page of my grid? e.g. I have a grid that gets it's data from entity framework using linq. It has pagination enabled and gets each page from the server as requested. Is there a good way to search for a specific record and navigate to the page it's on and start inline editing it?
Preslav
Telerik team
 answered on 13 Mar 2018
3 answers
255 views

I have tried setting up a pivot grid following the demos at http://demos.telerik.com/aspnet-mvc/pivotgrid/local-flat-data-binding and http://demos.telerik.com/aspnet-mvc/pivotgrid/remote-flat-data-binding.

 

using this model

public class FundModel
{
    public string AssetClass { get; set; }
    public DateTime ReportDate { get; set; }
    public decimal? AssetsStart { get; set; }
}
 

 and this controller

 

public ActionResult TestView()
{
    return View(
       // GetAdvisors()
       GetFunds()
        );
}
 
 
private IEnumerable<FundModel> GetFunds()
{
    IEnumerable<FundModel> funds;
    using (var context = new EPFRUI_Entities())
    {
        funds = context.vwDailyFundFlowDetails.Take(300).Select(x => new FundModel
        {
            AssetClass = x.FundName,
            ReportDate = x.ReportDate,
            AssetsStart = x.AssetsStart
        }).ToList();
    }
    return funds;
}

 â€‹I am passing in my data to this pivot grid based on the demo code

 

    @(Html.Kendo().PivotConfigurator()
    .Name("configurator")
    .Height(570)
)
 
@(Html.Kendo().PivotGrid<FundModel>()
    .Name("pivotgrid")
    .Configurator("#configurator")
    .ColumnWidth(120)
    .Height(570)
    .BindTo(Model)
    .DataSource(dataSource => dataSource
        .Ajax()
        .Schema(schema => schema
            .Model(m => m.Field("CategoryName", typeof(string)).From("Category.CategoryName"))
            .Cube(cube => cube
                .Dimensions(dimensions => {
                    dimensions.Add(model => model.AssetsStart).Caption("Assets Start");
                    dimensions.Add("CategoryName").Caption("All Categories");
                    dimensions.Add(model => model.AssetClass).Caption("AssetClass");
                })
            .Measures(measures => measures.Add("AssetsStart").Field(model => model.AssetsStart).AggregateName("count"))
            ))
        .Columns(columns =>
        {
            columns.Add("CategoryName").Expand(true);
            columns.Add("AssetClass");
        })
        .Rows(rows => rows.Add("AssetClass").Expand(true))
        .Measures(measures => measures.Values("Sum"))
        .Events(e => e.Error("onError"))
    )
)

 

Which is getting me a single long line when I run the program and navigate to the view. I have included what shows up in the attached image.

 

I have also tried setting this up with remote binding and got the same view.

 

Am I missing an obvious step here? I debugged it and the model has data when the pivot grid is called, and no errors are coming back from the pivotgrid

 

 

 

Stefan
Telerik team
 answered on 13 Mar 2018
2 answers
235 views

Hi,

When using the Export to Excel is only works for the current page, is there anyway to export the whole table (dataset)?

Thanks,
Lee.

Lee
Top achievements
Rank 1
Veteran
 answered on 12 Mar 2018
2 answers
934 views

First off, I am very new to MVC, so apologies in advance.

I don't know what I'm missing, but I have an enum type:

 public enum ClientStatus
    {
        [Description("Unknown")]
        Unknown = 0,
        [Description("Normal")]
        Normal = 1,
        [Description("Legal Hold")]
        LegalHold = 200
    }

There is a database field which holds the integer value corresponding to the enum type.  For my grid, I have:

Html.Kendo().Grid<IST.DocstorClient.Database.cache_dsl_client>()
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.dsl_client_id).Title("Client ID").EditorTemplateName("#dsl_client_id#");
                        columns.Bound(o => o.dsl_client_name).Title("Client Name");
                        columns.Bound(o => o.dsl_client_description).Title("Description");
                        columns.Bound(o => o.dsl_client_status).Title("Status").ClientTemplate("#=status_name#").EditorTemplateName("ClientStatus");
                        columns.Command(cmd => cmd.Destroy());
                    })
                    .ToolBar(toolbar =>
                    {
                        toolbar.Create();
                        toolbar.Save();
                    })
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .Pageable()
                    .Navigatable()
                    .PersistSelection()
                    .Sortable()
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Batch(true)
                        .PageSize(10)
                        .Model(model =>
                        {
                            model.Id(p => p.dsl_client_id);
                            model.Field(p => p.dsl_client_id).Editable(false);
                        })
                        .Events(events => events.Error("dsr_error_handler"))
                        .Read("Editing_Read", "Client")
                        .Create("Editing_Create", "Client")
                        .Update("Editing_Update", "Client")
                        .Destroy("Editing_Destroy", "Client")

 

The item in question here is the column for dsl_client_status, which is defined as a byte? type in the Entity Framework definitions.

I also have a dropdown definition in Shared/EditorTemplates:

@(Html.Kendo().DropDownListFor(m => m)
   .Name("ClientStatus")
   .DataTextField("Text")
   .DataValueField("Value")
   .BindTo(EnumHelper.GetSelectList(typeof(IST.DocstorClient.Data.ClientStatus)))
   .OptionLabel("Select Status")
   .Value(((int)Model).ToString())
  )

 

I have been through a lot of iterations of different things, this is just the state things are in at the moment.

When I click on the cell to edit, I do get the dropdown list, but it is defaulted to the "Select Status", as if there is no value assigned.  I can then change the dropdown value, but the database value never gets updated.  If I click on it again, the value I changed to shows on the dropdown.

For example:

initial value is "Unknown".  
I click to edit, the dropdown list defaults to "Select Status".  
I change to "Normal" and click Save Changes. Text still shows as "Unknown".  
I click to edit again and the dropdown is defaulted to "Normal"

I've been scouring forums and blogs for days, trying all manner of suggestions, all to no avail.  I find it hard to believe that this is that difficult a task to achieve, so I gotta think I'm missing something simple here.

Dimitar
Telerik team
 answered on 12 Mar 2018
1 answer
113 views

We are trying to make to make our Grid date columns have the verbiage and filter options of "From" and "To". Our hope was that after updating them within the razor syntax we could still use the "AND OR" values. It appears to remove that option after we have to run the ".Operators(operators => operators.ForDate(d => d.Clear()".

 

Is there something we are doing wrong? When seem to need to run the ".Clear()" to remove other filter options but now we only have one value we can enter. Either being "To" or "From" but not being able to do "To: (n)" [AND | OR] From:".  Is this not possible if we are customizing the filters or is there a different route we can take to acomplish this?

 

-Thanks-

Code Example:

").Filterable(filterable => filterable.Extra(false).Operators(operators => operators.ForDate(d => d.Clear().IsLessThanOrEqualTo("To").IsGreaterThanOrEqualTo("From")))

 

Stefan
Telerik team
 answered on 12 Mar 2018
1 answer
114 views

Hi,

because my dropdown has over 1.000 possible values I've implemented ServersSide filtering

according to this example.

https://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering

the only issue is that with a 1000 records servers side filtering still is slow when expanding the dropdownlist. because it the text is empty, all data is retrieved.

To avoid this issue I only select top 100 ".Take(100)" and the performance is way better.

the only issue is, when I open the dropdown for the 2nd time the selected item gets reset to the default one, if the selected item is not in the first 100 records.
In my oppinion, the current selected item should stay.

so My question, is there a way to make the current value stay,
or can I send the current selected value as a parameter?
for the edit Form, I already use the current value, so at least that one is always in the selection

read.Action("FilteredDDL", "some Controller", new { selectedValue = @Model.selectedvalue });

but this only helps if the value is already in the model.

 

Does someone know a good solution?

sjarl
Top achievements
Rank 1
 answered on 09 Mar 2018
2 answers
279 views
     My company just purchased the licenses for Telerik UI for ASP.NET MVC and I am trying to convert and our current project into a Telerik project, but I dont see the option to convert.  I only see the create new Telerik project option.  I have looked all over the website and the documentation site, but I dont see anything regarding this issue.  Am I missing something or is the option not there to convert an MVC 4 web app?
Justin
Top achievements
Rank 1
 answered on 09 Mar 2018
1 answer
498 views

Hi, i'm working with Telerik MVC controls (not Kendo controls) as this is an old application and it's been very difficult trying to get any documentation for it as everythings for Kendo now.

 

I'm trying to get partial views working with this window and using the .refresh() accompanied with the .open() method but i can't get the correct behaviour for this to work.

The URL has been set to one of the methods in the controller and it's not being hit at all and the window is just rendering blank with no items inside it.

 

Initially this screen was made dynamically using jquery as an iframe - which is why i've updated it to use a static Telerik window (not iframe) and using the .refresh() method but to no avail.

 

The window looks like the below:

 

01.@(Html.Telerik().Window()
02.    .Name("detailWindow")
03.    .Title("Edit Window")
04.    .Modal(true)
05.    .Draggable(true)
06.    .Width(200)
07.    .Height(100)
08.    .Visible(false)
09.)

 

And the jquery to perform the refresh looks as follows:

01.    var abc= $("#detailWindow").data("tWindow");
02.    abc.refresh({
03.        url: url, ==> this is a valid URL but controller isn't being hit
04.        title: "wat",
05.        data: {
06.            id: 1,
07.            id2: 2
08.        },
09.    });
10.     abc.center().open();

 

 

Is there some file that i'm missing or an issue with the above code?

 

 

Thanks

Nencho
Telerik team
 answered on 08 Mar 2018
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?