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

In synchronous mode, it's easy to take a server side action when all files are processed via foreach (var file in files), when it is completed. But how to do this in async mode? The server controller has no notion of the total number of files. And I don't see an Event fired when all the files are upload, although the control has the "Done" UI indication.

 

thanks, Tom

 
Dimiter Madjarov
Telerik team
 answered on 29 Jan 2016
2 answers
1.0K+ views

I'm creating a grid for a model that has child relationship that is not required.  The grid displays when the child has a value but if the child is null then I get a message that a value can't be null.  For example.   If my model is:

public class ProjectTypeViewModel
{
     [Column("ManpowerProjectTypeID")]
     public int ID { get; set; }

     [StringLength(50)]
     [Display(Name = "Project Type")]
     public string ProjTypeDesc { get; set; }

     [UIHint("ClientProjectType")]
     public ProjectTypeComboViewModel ParentProjectType { get; set; }
}

public class ProjectTypeComboViewModel
{
     [Column("ManpowerProjectTypeID")]
     public int ID { get; set; }

      [StringLength(50)]
      [Display(Name = "Project Type")]
      public string ProjTypeDesc { get; set; }

Then my grid looks like:

@(Html.Kendo().Grid<ManpowerForecast.Web.ViewModels.ProjectTypeViewModel>()
.Name("gridProjectType")
.Columns(columns =>
{
   columns.Bound(c => c.ProjTypeDesc).Width(200);
   columns.Bound(c => c.ParentProjectType).ClientTemplate("#=ParentProjectType.ProjTypeDesc#")
          .Width(150);
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.HtmlAttributes(new { style = "height: 550px" })
.Refresh(true)
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model =>
{

     model.Id(prop => prop.ID);
     model.Field(b => b.ParentProjectType).DefaultValue(ViewData["defaultProjectTypes"] as ProjectTypeComboViewModel);
})
.Create(create => create.Action("CreateManpowerProjectTypes", "Manpower"))
.Read(read => read.Action("ReadManpowerProjectTypes", "Manpower"))
.Update(edit => edit.Action("UpdateManpowerProjectTypes", "Manpower"))
.Destroy(delete => delete.Action("DestroyManpowerProjectTypes", "Manpower"))
.PageSize(20)
)
)

 

this displays just fine as long as ParentProjectType has a value but if it is null I get an error in the browser consul that reads: ProjTypeDesc is null.  If I comment out all the lines that have to do with the ParentProjectType the grid will display the data but off course doesn't contain the parent project type field.  How do I indicate in the grid that the data isn't required or is nullable?

 

 

Viktor Tachev
Telerik team
 answered on 29 Jan 2016
1 answer
113 views

I am trying to bind a grid in the editor template that contains List<> and have the ability to add and edit this list I need to do this in multiple places so Any idea would help a lot.

Model:

public int AgencyId { get; set; }
public string AgencyName { get; set; }
public int AgencyNumber { get; set; }
public string TIN { get; set; }
public bool Incorp { get; set; }
public string Affiliat { get; set; }
public IList<AgencyLocation> AgencyLocationCollection 

 Cshtml

<individual Field edits>

Need a grid here that will show all the associate locations and allow add and edit

  @(Html.Kendo().Grid<AgencyLocation>()
.Name("Grid")
.EnableCustomBinding(false)
.BindTo(Model.AgencyLocationCollection)
.Columns(columns =>
{
columns.Bound(m => m.AddressShortString);
columns.Bound(m => m.AgencyLocationId);
})
)

 

 

 

 

Dimo
Telerik team
 answered on 29 Jan 2016
1 answer
168 views

I'm using a Kendo UI Grid in conjunction with two AutoComplete widgets.  Everything mostly works perfectly, however, if a user pages through the grid and then does a search using one of the AutoComplete widgets, the grid does not display the data.  The pager at the bottom of the grid is updated but the grid is blank.  The user must click on a page before the data is displayed.  I have not been able to find a setting to resolve this despite hours of Googling.  Here's the code for my grid: 

@(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(a => a.EmployeeOI).Visible(false);
            columns.Bound(a => a.DepartmentOI).Visible(false);
            columns.Bound(a => a.LevelId).Width(60).Title("Level");
            columns.Bound(a => a.DepartmentName).Width(150).Title("Department");
            columns.Bound(a => a.EmployeeId).Width(60).Title("Emp");
            columns.Bound(a => a.BuyerName).Width(100).Title("Buyer Name");
            columns.Bound(a => a.MinAmount).Width(100).Title("Min Amt");
            columns.Bound(a => a.MaxAmount).Width(100).Title("Max Amt");
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
        })
        .ToolBar(toolbar => toolbar.Create())
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Pageable()
        .Sortable(s => s
            .AllowUnsort(false)
            .SortMode(GridSortMode.MultipleColumn))
    .Scrollable()
    .HtmlAttributes(new { style = "height:650px;, width:100%" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Sort(x => x.Add(y => y.LevelId).Ascending())
        .Sort(x => x.Add(y => y.MaxAmount).Ascending())
        .ServerOperation(false)
        .PageSize(8)
        .Events(events => events.Error("error_handler"))
        .Read(read => read.Action("Read", "Home").Data("gridAddlData"))
        .Create(update => update.Action("EditingPopup_Create", "Home"))
        .Update(update => update.Action("EditingPopup_Update", "Home"))
        .Destroy(update => update.Action("EditingPopup_Destroy", "Home"))
      .Model(m =>
      {
          m.Id(i => i.Id);
          m.Id(i => i.EmployeeOI);
          m.Id(i => i.DepartmentOI);
          m.Field("LevelID", typeof(string));
          m.Field("EmployeeId", typeof(string));
          m.Field("BuyerName", typeof(string));
          m.Field("MinAmount", typeof(decimal));
          m.Field("MaxAmount", typeof(decimal));
          m.Field("DepartmentId", typeof(string));
      })
      )
    )

Radoslav
Telerik team
 answered on 29 Jan 2016
6 answers
220 views
We have a rather large project that uses the Telerik UI for ASP.NET AJAX tools.  We are looking to do our new work in this project using the UI for MVC controls.  Are there any issues mixing these two Telerik toolsets in a single project?  We cannot seem to find any information on this online.
Dan
Top achievements
Rank 1
 answered on 28 Jan 2016
1 answer
108 views

I'm working through the Grid HtmlHelper extension example in the Telerik documentation. I get red squiggly line with 2 errors.Unknown method and unknown type. When i debug I get " CS0246: The type or namespace name 'KendoGridServerBinding' could not be found (are you missing a using directive or an assembly reference?)" I have the add namespace in web.config and the kendo.mvc is referenced in my project. I have attached the code and error.

 

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 27 Jan 2016
7 answers
705 views

I've downloaded and I'm running the kendoui-northwind-dashboard-master project.

In the OrdersController I've set a breakpoint on the Orders_Read Action.

I run the application in Debug and navigate to the Products & Orders page.

In Locals I drill down into orders/Results View and it returns 830 records.

I then set the Order Date filter to 'Is after 4/22/1998'.

In Locals I again drill down into orders/Results View and it still returns 830 records.

The view properly filters and returns 34 items.

1. Is Lazy Loading being used in this Grid?

2. If so how do I verify only the filtered records are returned from the DB query?

3. If Lazy loading is not being used in this project could you point me to or supply me with one that is?

 

I need to be able to build a project that scales properly so that I can return a subset of records rather than the thousands of records that will be in the database.

 

 

 

 

 

Viktor Tachev
Telerik team
 answered on 27 Jan 2016
7 answers
516 views

I've found a strange behaviour thats happening when i've got a grouped multi select list (again virtualised as asked in the other thread "Multi select change event not firing") and try to select an item.

 

The grouping function itself seems fine, as i can see the different items are under their respective headers, however when i try to select an item from the drop down list, a completely different item is selected instead of the selected item (most of the time it seems to be reversed, e.g. items 1, 2, 3, 4 showing on grouped list. Select item 1, and item 2 gets selected. Select item 2, item 1 gets selected. Sometimes the correct item is selected).

 

If there is no grouping applied, the selected value is always correct.

Alexander Popov
Telerik team
 answered on 27 Jan 2016
2 answers
150 views

Hi,

For a Grid where inline editing is enabled and where the rows being edited contain dropdown lists, checkboxes and textboxes I would like to be able to toggle certain textboxes or ddls when a checkbox is checked/unchecked.

Please could someone advise the recommended approach to achieve this?

Thanks in advance.

Kostadin
Telerik team
 answered on 27 Jan 2016
3 answers
813 views
 I try to make a grid hierarchy. I have two grids. One of them is inside of the other. Parent grid reads the data via ajax read method. Returning json result has a field of a list. I want to use this list for populating the inner grid. But i get an error of Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well.
@(Html.Kendo().Grid<Customers>().Name("grid")
    .Scrollable()
.Pageable().Columns(columns =>{         columns.Bound(o => o.CompanyName);         columns.Bound(o => o.ContactName);}).DetailTemplate(@<div>@(Html.Kendo().Grid<Phones>(item.Phones).Name("g" + item.ID).Scrollable().Pageable().Columns(columns =>{                         columns.Bound(o => o.Number);}))</div >).DataSource(datasource => datasource
        .Ajax().Read(read => read.Action("GetCustomers", "Home", new { x = "asd"}))))

I dont want the inner grid read via ajax. I want it to use the list field of returning json.
Radoslav
Telerik team
 answered on 27 Jan 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?