Telerik Forums
UI for ASP.NET MVC Forum
1 answer
2.0K+ 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
985 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
852 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
848 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
156 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
1.0K+ 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
249 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
2.1K+ 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
821 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
1 answer
163 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
DropDownButton
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?