Telerik Forums
UI for ASP.NET MVC Forum
1 answer
250 views
Hi, 

I am using two kendo tree views in my screen. The trees are taking long to load.  Each of the tree has around 200 nodes with checkbox. I added .LoadOnDemand(true), but not of much help. 

I am populating treeviews models in C# and passing it to the razor views. I am attaching my treeview's razor files (CasTradeOrgnTreePartial.cshtml and CasTradeDestTreePartial.cshtml) and C# procedure (populate_tree_model_C#_procedure.cs) . 

Please advise, how to speed up the tree loading time.

Regards, 

Manoj
Alexander Popov
Telerik team
 answered on 28 Jul 2014
1 answer
486 views

Hi - I just have a list of strings to bind.

I get the list from splitting a comma separated list...

I want the list of selected values posted to the server:

​ var multiselections = Model.InformationIntakeGroupOption.Split(new char[] {','}).ToList();
 @(Html.Kendo().MultiSelectFor(model => model.InformationIntakeValue)
 .Placeholder("Click here to select opitons...")
 .BindTo(multiselections)
 .AutoClose(false)
 .Animation(false)
 )

All I get is the first selected value, not all selected values...

Any ideas?
Eric
Top achievements
Rank 2
 answered on 25 Jul 2014
1 answer
205 views
Been working on this for too long now. I have a detail grid where one of the columns is not editable by the user. It's value is calculated based on values in other fields/columns. If the user changes one of these, a stored proc is ran on the server that updates the calculated field. I have verified that the database is updated correctly. The problem is the grid is not refreshing/rebinding unless i force a datasource read (reload page, change pages in grid , etc.) . I know this is something silly on my part; maybe someone can point out my problem.

Here is my grid definition: 

@(Html.Kendo().Grid<CNX.Domain.Entities.CnxRailcar> ()
         .Name("ReceivedTrains_#=Id#")         
         .Editable(editable => editable.Mode(GridEditMode.InCell))         
         .Columns(columns =>
           {                   
               columns.Bound(o => o.Id).Visible(false);
               columns.Bound(o => o.CNX_TRAIN_GUID).Visible(false);
               columns.Bound(o => o.PERMIT_NUMBER).EditorTemplateName("_textEditor").Width(50);
               columns.Bound(o => o.OWNER_CODE).EditorTemplateName("_textEditor").Width(25);
               columns.Bound(o => o.OWNER_EQUIPMENT_NUMBER).Width(80).EditorTemplateName("_textEditor");
               columns.Bound(o => o.EQUIPMENT_NUMBER).Width(80).EditorTemplateName("_textEditor");
               columns.Bound(o => o.SEQUENCE_NUMBER).Width(75).EditorTemplateName("_numericTextEditor");
               columns.Bound(o => o.PILE).Width(75).EditorTemplateName("_PilesDropDown").Width(100);
               columns.Bound(o => o.CLASS).Width(75).EditorTemplateName("_classDropDown");
               columns.Bound(o => o.LOT).Width(75).EditorTemplateName("_textEditor"); 
               columns.Bound(o => o.COMMENTS).EditorTemplateName("_commentsDropDown").Width(100);
               columns.Bound(o => o.STATUS).EditorTemplateName("_railcarStatusDropDown").Width(100).Filterable(filterable => filterable
                                                                               .UI("statusFilter")
                                                                               .Extra(false)
                                                                               .Operators(operators => operators
                                                                                                       .ForString(str => str.Clear()
                                                                                                       .IsEqualTo("Is Equal To")
                                                                                                       .IsNotEqualTo("Is Not Equal To"))));              
           })
           .Events(ev => ev.Save("receivedRailcars_Save").DataBinding("loadToolBar(\'#=Id#\')").DataBound("colorDatabound").Cancel("colorCancel").Edit("colorEdit"))
           .DataSource(dataSource => dataSource.Ajax()
                                               .PageSize(10)
                                               .Read(read => read.Action("CnxRailcars" , "MenuTrain" , new { trainGuid = "#=Id#" } ).Type(HttpVerbs.Post))
                                               .Update(update => update.Action("CnxRailcarUpdate", "MenuTrain", Model).Type(HttpVerbs.Post)).Model(model => model.Id(o => o.Id)))
           .ToolBar(tb =>
               {
                   tb.Template("<table id='batchApply'><tr><td colspan='3' style='text-align : left ;'><input type='button' value='Add Railcar' id='addCar_#Id#' class='k-button' onclick='addCar(\"" + "#=Id#" + "\")'</td>" +
                       "<td><input type='button' value='Locomotive Details' id='viewLoco_#Id#' class='k-button' onclick='viewLoco(\"" + "#=Id#" + "\")'</td></tr>" +
   "<tr><td><label>Car Range</label></td><td><label>Select Class</label></td><td><label>Select Pile</label></td><td></td></tr>" +
   "<tr><td><table><tr><td><label style='text-align : right ;'>start</label></td><td style='text-align : left ; '><input id='carStart_#=Id#' /></td></tr>" +
   "<tr><td><label style='text-align : right ;'>end</label></td><td style='text-align : left ;'><input id='carEnd_#=Id#' /></td></tr></table><td><div id='detailClass_#=Id#' /></td>" +
   "<td><div id='detailPile_#=Id#' /></td><td><input type='button' value='Apply To Cars' id='applyLot_#=Id#' class='k-button' onclick='apply(\"" + "#=Id#" + "\")'/></td></tr></table>"
                       );
               })                                               
           .Pageable()
           .Sortable()           
           .Filterable(filterable => filterable.Extra(false))      
           .ToClientTemplate()
   )

Here is my saved event handler for the grid : 

function receivedRailcars_Save(e) {
          
       if (e.values.CnxComments != null) {
           e.model.set("COMMENTS" , e.values.CnxComments.CNX_COMMENT_DESCRIPTION) ;
       }
       else if (e.values.RailCarStatus != null) {
           e.model.set("STATUS", e.values.RailCarStatus.CNX_RAILCAR_STATUS_DESCRIPTION);
       }
       else if (e.values.CnxPiles != null) {
           e.model.set("PILE", e.values.CnxPiles.CNX_PILE_NUMBER);
       }
       else if (e.values.CnxClasses != null) {
           e.model.set("CLASS", e.values.CnxClasses.CNX_CLASS_NAME);
       }
       else {
           var myReflector = new reflector(e.values);
           var reflectorProperties = myReflector.getProperties();
           e.model.set(reflectorProperties[0], e.values[reflectorProperties[0]]);
       }
 
       e.sender.dataSource.sync();
   }

The line e.sender.dataSource.sync() forces the update action method to be called on the server. Here's that action method:

[HttpPost]
        public JsonResult CnxRailcarUpdate(CnxRailcar railCar, [DataSourceRequest] DataSourceRequest request)
        {           
            try
            {
                cnxRailcarRepository.Save(railCar); 
                cnxRailcarRepository.ApplyLots(railCar.CNX_TRAIN_GUID);  
            }
            catch (Exception e)
            {              
                Response.StatusCode = 550;
                Response.Write(e.Message);
            }
            return Json(cnxRailcarRepository.Railcars(railCar.CNX_TRAIN_GUID).Where(x => x.Id == railCar.Id).ToDataSourceResult(request));
        }

The repository's ApplyLots method just calls a stored proc on the database, and update the db context of the repository.

Any suggestions?




















Nikolay Rusev
Telerik team
 answered on 25 Jul 2014
7 answers
386 views
We have just downloaded the latest July release of Kndo wrappers for MVC . We are trying to test them side by side with the MVC extensions however we get the following error when building the project after adding reference to the Kendo dll

'SliderTickPlacement' is an ambiguous reference between 'Telerik.Web.Mvc.UI.SliderTickPlacement' and 'Kendo.Mvc.UI.SliderTickPlacement'

You do say that it is possible to use  Kendo  within the same project. Would appreciate clarification.
Many thanks
Ed
Top achievements
Rank 1
 answered on 25 Jul 2014
1 answer
475 views
Hi,

I recently started working on Asp.Net MVC and also very new to Telerik UI for asp.net mvc. I created a new telerik mvc project and set the authentication mode to windows in web.config. The application runs fine on my PC. But when I upload it on to a windows server, it gives me a 'Resource not found' error indicating that it is missing login.aspx file. Is there another way to set the authentication mode to windows and get the application working in Telerik UI?
Please help.

Thanks.
Sebastian
Telerik team
 answered on 25 Jul 2014
1 answer
332 views
Here is a screen shot of my all. Validation are not working on Kendo Upload control used.



View has code:


 <div class="col-md-4">
                    @Html.Label("file", "Select File")
                    @(Html.Kendo().Upload()
                          .Name("upload")
                          .Multiple(false)
                          .Messages(msgs => msgs.Select("Browse"))
                          )
                   @Html.ValidationHtmlMessageFor(model => model.UploadFileName)
                </div>
                <div class="col-md-4 buttonBox">
                    @Html.Kendo().Button().Name("Save").Content("Upload File").HtmlAttributes(new {type = "submit"}) 

Code in View Model:

    [Required(ErrorMessageResourceType = typeof(Resources.Resources),
                  ErrorMessageResourceName = "FieldRequired")]
        [Display(Name = "Month")]
        public int ObjectiveMonth { get; set; }


Controller checks for ModelState.isValid

But the validation message do not show up

What could the reason be?

















Dimiter Madjarov
Telerik team
 answered on 25 Jul 2014
1 answer
269 views
Number of records to display should be a drop down with the number of users they would like to view per page. The default number should be 10 records. I want the selection criteria should be in denominations of 10 up to 40. (10, 20, 30, 40) 

Code in View:

@(Html.Kendo().Grid<IncentiveViewModel>()
            .Name("Incentive")
            .Columns(columns =>
            {
                columns.Bound(p => p.Make).EditorTemplateName("MakeDropDown").Sortable(true);
                columns.Bound(p => p.Model).EditorTemplateName("ModelDropDown").Sortable(true);
                columns.Bound(p => p.Year).Sortable(true);
                columns.Bound(p => p.Term);
                columns.Bound(p => p.Rate);
                columns.Bound(p => p.StartDate).Format("{0:MM/dd/yyyy}");
                columns.Bound(p => p.EndDate).Format("{0:MM/dd/yyyy}");
                columns.Bound(p => p.IsActive).ClientTemplate(
                    "# if (IsActive) { #" +
                        "Yes" +
                    "# } else { #" +
                        "No" +
                    "# } #"
                    );
                columns.Template(@<text></text>)
                    .Width(110)
                    .ClientTemplate(@"<a class=""k-grid-delete"" href=""\#""></a>");
            })
            .ToolBar(toolbar =>
            {
                toolbar.Create().Text("Add Incentive");
                toolbar.Save().SaveText("Save Changes").CancelText("Cancel Changes");
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            .Resizable(resize => resize.Columns(true))
            .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(10))

            .Navigatable()
            .Sortable()
            .Resizable(resize => resize.Columns(true))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .PageSize(10)
                .ServerOperation(false)
                    .Events(events => events.Error("ds_onError").Sync("incentivesDs_onSync").RequestEnd("ds_onRequestEnd"))
                .Model(model =>
                {
                    model.Id(p => p.IncentiveId);
                    model.Field(p => p.Year).Editable(true);
                    model.Field(p => p.Make).Editable(true);
                    model.Field(p => p.Model).Editable(true);
                    model.Field(p => p.Rate).Editable(true);
                    model.Field(p => p.StartDate).Editable(true);
                    model.Field(p => p.EndDate).Editable(true);
                    model.Field(p => p.IsActive).Editable(false);
                })
                .Create("Create", "Incentive")
                .Read("Read", "Incentive")
                .Update("Update", "Incentive")
                .Destroy("Destroy", "Incentive"))
                .Events(events => events.SaveChanges("incentivesGrid_onSaveChanges").Edit("grid_onEdit"))
         )

Even with this setting I see a paging drop down with 5, 10, 20 where as I want 10, 20, 30, 40..etc

Here is the result:

 




Dimo
Telerik team
 answered on 25 Jul 2014
1 answer
461 views
I am allowing my users to select rows in a kendo grid via a checkbox in the first column and right now the selections are lost if/when they change pages.  I was hoping there would be a way i could show a confirm dialog when when they click the page, but before the page changes and either
1) allow them to perform an action on the selected rows
2) lose the selections
3) stop the page change from occurring

I am having trouble actually stopping the page change from happening.  Are there any samples on how to do this?

Thanks,
-Logan
Dimiter Madjarov
Telerik team
 answered on 25 Jul 2014
3 answers
278 views
I have tried following the Validation Guide and the Batch Editing example but something is still amiss. The validation tooltip does not appear when I attempt to Save Changes after leaving a required field empty (i.e. Rate). We are using ASP.NET MVC 4 Razor and Kendo UI 2014.1.415.

CSHTML
@(Html.Kendo().Grid<IncentiveViewModel>()
      .Name("Incentive")
      .Columns(columns =>
      {
          columns.Bound(p => p.Make).EditorTemplateName("MakeDropDown").Sortable(true);
          columns.Bound(p => p.Model).EditorTemplateName("ModelDropDown").Sortable(true);
          columns.Bound(p => p.Year).Sortable(true);
          columns.Bound(p => p.Term);
          columns.Bound(p => p.Rate);
          columns.Bound(p => p.StartDate).Format("{0:MM/dd/yyyy}").EditorTemplateName("CalendarPicker");
          columns.Bound(p => p.EndDate).Format("{0:MM/dd/yyyy}");
          columns.Template(@<text></text>)
              .Width(110)
              .ClientTemplate(@"<a class=""k-grid-delete"" href=""\#""></a>");
      })
      .ToolBar(toolbar =>
      {
          toolbar.Create().Text("Add Incentive");
          toolbar.Save().SaveText("Save Changes").CancelText("Cancel Changes");
      })
      .Editable(editable => editable.Mode(GridEditMode.InCell))
      .Resizable(resize => resize.Columns(true))
      .Pageable(pageable => pageable
          .Refresh(true)
          .PageSizes(true)
          .ButtonCount(10))
      .Navigatable()
      .Sortable()
      .Resizable(resize => resize.Columns(true))
      .DataSource(dataSource => dataSource
          .Ajax()
          .Batch(true)
          .PageSize(10)
          .ServerOperation(false)
          .Model(model =>
          {
              model.Id(p => p.IncentiveId);
              model.Field(p => p.Year).Editable(true);
              model.Field(p => p.Make).Editable(true);
              model.Field(p => p.Model).Editable(true);
              model.Field(p => p.Rate).Editable(true);
              model.Field(p => p.StartDate).Editable(true);
              model.Field(p => p.EndDate).Editable(true);
          })
          .Create("Create", "Incentive")
          .Read("Read", "Incentive")
          .Update("Update", "Incentive")
          .Destroy("Destroy", "Incentive"))
      )


ViewModel (abbreviated with just one field)
[Display(Name = "Rate")]
[Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(Resources.Resources), ErrorMessageResourceName = "FieldRequired")]
[Range(0, 12, ErrorMessage = "Value for {0} must be between {1} and {2}.")]
public decimal? Rate { get; set; }

I noticed that no validation attributes are being appended to the input field:
<input class="text-box single-line" id="Rate" name="Rate" type="text" value="" data-bind="value:Rate">


What am I missing? What more do you need to see? Thanks.

Adam
Rosen
Telerik team
 answered on 25 Jul 2014
7 answers
915 views
Hi,

Is there the way to hide all the times grid and just keep "All Day" row, since visits in my project are whole day events?

I have tried to set business hours to the same time, it didn't worked for me.

Any suggestion?

Thank you,
-Yuriy
Reiner
Top achievements
Rank 1
 answered on 24 Jul 2014
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
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
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
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?