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

As I've been learning about the grid, I've noticed in most of your examples, the grid is being call from a jquery ready function.  Can you explain this technique, or probably better, point me to documentation that explains this to me. 

 

 

Nikolay
Telerik team
 answered on 09 Sep 2019
1 answer
1.8K+ views
I want to show the total number of records in a grid, in the grid footer, but I do not want to have pagination in my grid.  How do I accomplish this?
Tsvetomir
Telerik team
 answered on 09 Sep 2019
3 answers
843 views

Grid column filter operator list shows No Data Found when I have a column with a ClientTemplate

columns.Bound(roomIndex => roomIndex.RoomBuilding)
            .Title("Building")
            .EditorTemplateName("BuildingSelect")
            .ClientTemplate("#=RoomBuilding.BuildingName#")

 

I attempted to fix the problem by adding an operator (below) but my list of filter operators is still empty and I don't understand why the above code doesn't work.

        columns.Bound(roomIndex => roomIndex.RoomBuilding)
            .Title("Building")
            .EditorTemplateName("BuildingSelect")
            .ClientTemplate("#=RoomBuilding.BuildingName#")
            .Filterable(filter => filter
                .Extra(false)
                .UI("buildingFilter")
                .Operators(operators => operators
                    .ForString(str => str.Clear().IsEqualTo("Is equal to"))
            ));

 

<script type="text/javascript">
    function buildingFilter(element) {
        element.kendoDropDownList({
            dataSource: {
                transport: {
                    read: "@Url.Action("GetSelectList", "Buildings")"
                },
            },
            dataTextField: "BuildingName",
            dataValueField: "BuildingId",
            optionLabel: "--Select Value--"
        });
    }
</script>

 

 

Georgi
Telerik team
 answered on 06 Sep 2019
12 answers
733 views

Hi There,

I'm studying grid samples and don't understand why deleting a record in the ForeignKey grid sample a breakpoint on the method below is not hid during Delete operation. I ask because I replicated the same approach in my application (with Customers and Countries tables) and I get a NullReferenceException in this method every time because the last parameter is null. What am I missing?

Thanks.

        [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult ForeignKeyColumn_Destroy([DataSourceRequest] DataSourceRequest request,
          [Bind(Prefix = "models")]IEnumerable<ProductViewModel> products)
      {
          foreach (var product in products)
          {
              productService.Destroy(product);
          }
 
          return Json(products.ToDataSourceResult(request, ModelState));
      }
Nikolay
Telerik team
 answered on 05 Sep 2019
2 answers
782 views

My model is quite complex but basically has a list of fields, each field then has a number of values that can be selected via a drop down. I loop through the fields and try and create a dropdown for each field: 

 

    @for (var i = 0; i < Model.Fields.Count; i++) {

            var fieldId = "field_" + i.ToString() + "_value_" + j.ToString();

            @(Html.Kendo().DropDownList()

                   .Name(fieldId)   
                   .Value(Model.Fields[i].Values[j])
                   .Filter("contains")
                   .DataSource(source =>
                          {
                               source.Read(read =>
                               {
                                    read.Action("TypeAhead", "Document", new { docType = Model.DocType, field = i });
                                 })
                                .ServerFiltering(true);
                            })
                     )

 

The DataSource just asks the DB what the predefined (drop down) values are for this field:

        public ActionResult TypeAhead([DataSourceRequest] DataSourceRequest request, string docType, int field)
        {
            var predefinedValues = GetPredefinedValuesForField(docType, field, "");
            return Json(predefinedValues);
        }

 

This works except that the values for the dropdown are being ADDED to each field -> i.e. field 1 has value1 and value2, field2 has value1, value2 (both from field 1) and then it's own values. 

 

It seems as if I have not bound what comes back from the DataSource in the controller to the field but rather to each field in return?

 

Any ideas as to what I am doing incorrectly?

 

 


Ursus
Top achievements
Rank 1
Iron
 answered on 05 Sep 2019
1 answer
107 views

Where can I find the data that is used to feed the demos for charts?  All of the chart demos have calls where I can't really see what data is being fed to the chart.  For example in the Treemap demo:

public ActionResult Index_PopulationUSA()
       {
           return Json(TreeMapDataRepository.PopulationUSAData(), JsonRequestBehavior.AllowGet);
       }

Where can I see the data in TreeMapdataRepository.PopulationUSAData?
Tsvetomir
Telerik team
 answered on 05 Sep 2019
15 answers
879 views
Hi All,

I've got the simplest upload control with batch mode enabled.

View is;
            @(Html.Kendo().Upload().Name("uploadFiles").Async(a => a.Save("Upload", "Home").AutoUpload(false).Batch(true)))

Controller is;
        public JsonResult Upload(IEnumerable<HttpPostedFileBase> uploadFiles)
        { 
                  return new JsonResult();
        }

Hoping to see a single call to the action which handles the upload with multiple files. Instead, once I hit upload, I see a separate request for each file that was selected. I must be doing something wrong but finding it hard to figure out what, since the setup is so simple.

Running it in IIS Express, however I've tried with IIS8 and that didn't work either.

Telerik Version: 2014.2.1008
Browser : Chrome 37.0.2062.124

Thanks a lot.
Chris R

Chris
Top achievements
Rank 1
 answered on 03 Sep 2019
1 answer
184 views

I have an autocomplete that populates with several pieces of information (Name, Type, Market Value - see attached image).  I would like to format this more like a table where each column lines up under the appropriate header.  I tried adding html table, tr, td etc. tags, but it did not work.  Is there an example of this being done or perhaps another way of using a grid control that is populated by the autocomplete?

 

@(Html.Kendo().AutoComplete()
       .Name("accounts")
       .DataTextField("DisplayNameExtendedDetails")
       .Filter("contains")
       .MinLength(2)
       .Placeholder("Type a name or account number")
       .HtmlAttributes(new { style = "width:100%" })
       .DataSource(source => source
             .Custom()
             .Group(g => g.Add("EntityType", typeof(string)))
             .Transport(transport => transport
                 .Read(read =>
                 {
                     read.Action("ServerFiltering_GetAccounts", "Account")
                     .Data("onAdditionalData");
                 }))
                 .ServerFiltering(true))
 
         .HeaderTemplate("<div class=\"dropdown-header k-widget k-header\">" +
                                 "<span>Name</span>" +
                                 "<span>Type</span>" +
                                 "<span>Market Value</span>" +
                             "</div>")
         .FooterTemplate("Total <strong>#: instance.dataSource.total() #</strong> items found")
         .Template("<span class=\"k-state-default\">#: data.MarketValueFormatted #    </span>" +
                     "<span class=\"k-state-default\"> #: data.DisplayName #</span>" +
                     "<span class=\"k-state-default\"> #: data.AccountType #</span>")
       .Events(e =>
       {
           e.Change("onAccountChange").Select("onAccountSelect");
       })
 )
Aleksandar
Telerik team
 answered on 03 Sep 2019
6 answers
1.8K+ views
Not exactly sure the best way to code the following scenario...I have Upload, ComboBox and Grid controls. The Grid has a column with a Dropdown/Select column. The data for this columns needs to be populated based upon the selected value of the ComboBox. The Grid itself is not populated until after the Upload control has performed its actions. The data (re)bound to the Grid also has the same value from the ComboBox.

I've tried two types of columns for the Grid. A Foreign Key column and a Bound column with an EditorTemplate. Both will retrieve an initial dataset of all records, but neither can I figure out how to filter or rebind based upon the new data (available after the Upload control is complete).

I'm working in MVC. I've looked at this doc http://docs.kendoui.com/api/wrappers/aspnet-mvc/Kendo.Mvc.UI.Fluent/GridBoundColumnBuilder#editorviewdatasystemobject but it does not allow me to pass data from the Model to the EditorTemplate as documented. I also was unable to find the documentation on how to use the EditorView object in the EditorTemplate.

ComboBox:
@(Html.Kendo().ComboBox()
    .Name("engineGroupList")
    .Placeholder("Select Engine Group...")
    .DataTextField("EngineGroupName")
    .DataValueField("EngineGroupId")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetEngineGroups", "Equipment")
                .Data("engineGroupFilter");
        });
    })
    .CascadeFrom("customerList")
    .Events(events => events.Change("engineGroupChange"))
)
Upload:
@(Html.Kendo().Upload()
    .Name("dasFiles")
    .Async(a => a
        .Save("UploadDas", "Data")
        .AutoUpload(true)
        .Batch(true)
    ).Events(events => events.Success("dasFilesSuccess")
)
Upload (Event Script):
function dasFilesSuccess(e) {
    var grid = $("#dasFilesGrid").data("kendoGrid");
    grid.dataSource.data(e.response.Data);
}
Grid - 2nd column needs to be a dropdown bound based on one of two possible parameter: FileUploadGroupId (in Grid data model) or EngineGroupId (value of ComboBox):
@(Html.Kendo().Grid(Model)
    .Name("dasFilesGrid")
    .Columns(columns =>
    {
        columns.Bound(m => m.FileUploadRawFileName);
        columns.Bound(m => m.FileUploadGroupId).EditorTemplateName("Engine");
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model =>
        {
            model.Id(e => e.FileUploadRawId);
        })
    )
)
EditorTemplate - Currently Binding to All EngineModels, but need to call either by EngineModel.GetByEngineGroupId(...) or GetByUploadGroupId(...):
@model List<EngineModel>
 
@(Html.Kendo().DropDownListFor(m => m)
        .Name("Engine")
        .DataValueField("EngineID")
        .DataTextField("Model")
        .BindTo((System.Collections.IEnumerable)EngineModel.All())
)
Ideas?
Viktor Tachev
Telerik team
 answered on 03 Sep 2019
24 answers
664 views

Hi

 

I saw a thread about not getting to the ID of a panelbar item in the OnSelect handler from 2012. I almost can't believe that Telerik did not yet fix this issue. But i can't find anything so i'm afraid they didn't. 

It should be that easy to add to the component.

 

Eric

 

Ivan Danchev
Telerik team
 answered on 30 Aug 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?