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

     Hello,

I am  new to MVC and Telerik. I am trying to devise a way to globally change themes (both those that come with Kendo in the C:\Program Files (x86)\Progress\Telerik UI for ASP.NET MVC R2 2019\styles folder and ones created via the SASS Theme builder.

I see the "Change Themes" drop down list at: https://demos.telerik.com/aspnet-mvc/dropdownlist 

and the https://docs.telerik.com/kendo-ui/styles-and-layout/change-themes-on-the-client

but I am curious as to how we would go about creating a dynamic list of all the themes that come with Telerik and all user created sass themes and apply them globally for a user AND be able to save that theme so it is loaded for a user and applied every time they visit the site and the ability to change the theme and save

that preference at anytime. Thoughts?

Thanks,

Petar
Telerik team
 answered on 09 Sep 2019
3 answers
272 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
893 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
777 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
791 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
116 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
908 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
198 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.9K+ 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
Window
ListView
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
Licensing
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
DropDownButton
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?