Telerik Forums
UI for ASP.NET MVC Forum
2 answers
58 views
I am looking for an example that loads a treeview from data that is not self-referencing (no ParentID field) but with specific category levels.  If my data looks like:
ID   Lastname     Firstname  City       State
1     Davolio         Nancy          Seattle   WA
2     Fuller            Andrew        Tacoma  WA
3     Washington George          Dallas     TX
4     Leverling      Janet            Kirkland  WA
5     Peacock       Margaret      Seattle    WA
6     Doe              Jane             Austin     TX
7     Doe              John             Dallas     TX

… I want it to come out like this:
TX
 └ Austin
          └ Jane Doe
└ Dallas
          └ George Washington
          └ John Doe
WA
  └ Kirkland
            └ Janet Leverling
  └ Seattle
            └ Nancy Davolio
            └ Margaret Peacock
   └ Tacoma
            └ Andrew Fuller


I also would like it to load on demand (JsonResult) as each state and city gets expanded.
Is there an example on how to build the tree like this?
Boyan Dimitrov
Telerik team
 answered on 29 Sep 2015
1 answer
104 views

Hi, 

Here's a question what event or function is called when the user presses the cancel or close button on the mvc grid popup editor. 

 

Best, 

A. Guzmán 

Boyan Dimitrov
Telerik team
 answered on 29 Sep 2015
2 answers
146 views

Hello,

selecting a DropDownList inside of a window-control results in a scrollbar on the side of the window-control. How can I prevent that?

I attached a screenshot so you can see what I am talking about.

Thanks in advance.

Oliver
Top achievements
Rank 1
 answered on 29 Sep 2015
1 answer
230 views

Assuming I have the below table:

@Html.Kendo().Grid(Model).Name("Staff").Columns(x =>{         x.Bound(y => y.StaffId);         x.Bound(y => y.FirstName);         x.Bound(y => y.LastName);         x.Bound(y => y.Email);         x.Bound(y => y.Phone);         x.Command(y => y.Custom("Edit").Action("edit", "controller", new { id = ????? }));}).Sortable().Scrollable().Pageable(x=> x.PageSizes(true)).Filterable()

 

How can I pass the primary key value (StaffId in this case) associated to the row to the object route values similar to the way it is done by Visual Studio auto-scaffold? I do not want a Java Script based solution. I am just looking for a way to pass the current row id (PK) to server action. Is it possible?

For more information please refer this SO thread.

Boyan Dimitrov
Telerik team
 answered on 29 Sep 2015
1 answer
258 views
Hello,
 I want to change combobox width but I have problem with ​styling. I attached screen capture, I tried two way for set combo width but not working well. I using bootstrap in my project. How can I fix this problem?

Here is my code,

<div class="form-group">
            @Html.LabelFor(model => model.MusteriId, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">              
                @(Html.Kendo().ComboBox()
          .Name("MusteriId")
          .Filter("contains")
          .Placeholder("Müşteri seçiniz...")
          .BindTo(ViewBag.MusteriId as SelectList)
          .Suggest(true)
          .HtmlAttributes(new { style = "width: 600px;" })
                )
                @Html.ValidationMessageFor(model => model.MusteriId, "", new { @class = "text-danger" })
            </div>
        </div><div class="form-group">
            @Html.LabelFor(model => model.AracId, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">               
                @(Html.Kendo().ComboBox()
          .Name("AracId")
          .Filter("contains")
          .Placeholder("Araç seçiniz...")
          .BindTo(ViewBag.AracId as SelectList)
          .Suggest(true)
          .HtmlAttributes(new { style = "width: 85%;" })
                )
                @Html.ValidationMessageFor(model => model.AracId, "", new { @class = "text-danger" })
            </div>
        </div>
Artuğ
Top achievements
Rank 1
 answered on 28 Sep 2015
1 answer
387 views

Hi, 

I'm working with telerik mvc grid, I'm trying to use the grid for crud operations, my model is supposed to have an id key which is stored in the model view item ut the user is not supposed to even know the id property can you help me not showing the id field in the edit popup. 

 

 

Best 

A. Guzman 

Dimiter Madjarov
Telerik team
 answered on 28 Sep 2015
1 answer
459 views

Hi, I've been working with telerik mcv grid, i've used a modelview to pass the data to the controller. Now i want the user to be available to edit the row information but every time the user presses the edit button on the grid the modal window shows the item id which is not suposed to be displayed

 This is the modelview 

public class EmpleadoViewModel
    {
        public int EmpleadoID { get; set; }
         
        [Required]
        public String Nombre { get; set; }
 
        [Required]
        public String Email { get; set; }
 
        [Required]
        public String Activo { get; set; }
 
        [Required]
        public String Role { get; set; }
    }

 

 This is the grid config

@(Html.Kendo().Grid<EmpleadoViewModel>()
               .Name("people_grid")
               .Columns(columns =>
               {
                   columns.Bound(e => e.Nombre).Title("Nombres").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Email).Title("E-Mail").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Activo).Title("Estado").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Role).Title("Rol de sitio").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Command(command =>
                   {
                       command.Edit().Text("Editar").HtmlAttributes(new { @class = "sharp", onmouseover = "editBtnPopover(this)", onmouseout="hidePopover(this)" });
                       command.Custom("Deshabilitar").Click("disablePerson").HtmlAttributes(new { @class = "sharp", onmouseover = "disableBtnPopover(this)", onmouseout = "hidePopover(this)" });
 
                   }).Title("Acciones").HeaderHtmlAttributes(new { style = "text-align:center" });
               })
               .ToolBar(toolbar =>
               {
                   toolbar.Create().Text("Nuevo").HtmlAttributes(new { id="new_btn" });
                   
               })
               .HtmlAttributes(new { style = "height:550px;" })
               .Editable(editable =>
                   editable.Mode(GridEditMode.PopUp).Window(window =>
                   {
                       window.Draggable(false);
                       window.Title("ICS: Personas");
                   }))
               .Scrollable()
               .Sortable()
               .Pageable(pageable =>
               {
                   pageable.Refresh(false);
                   pageable.PageSizes(true);
                   pageable.ButtonCount(5);
               })
                
               .Events(events => events.Change("getSelectedItem"))
               .DataSource(dataSource => dataSource
                   .Ajax()
                    
                   .PageSize(10)
                   .Model(model =>
                   {
                       model.Id(emp => emp.EmpleadoID);
                       model.Field(emp => emp.EmpleadoID).Editable(false);
                   })
                   .Create(update => update.Action("EditingPopup_Create", "Grid"))
                   .Read(read => read.Action("Read_Alpes_Employees", "Demo"))
                   .Update(update => update.Action("EditingPopup_Update", "Grid"))
                   .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
               )
           )

 

Boyan Dimitrov
Telerik team
 answered on 28 Sep 2015
1 answer
389 views

Hi, 

I'm working with telerik grid and using a custom modelview element to pass the data to the controller, when the user presses the Edit button inside the grid it should display the modelview item information or at least the information I want it to show, but so far just errors and an inconsistent look and feel when I use telerik controllers,

I've configured the Edit command to only show all fields of my viewmodel except the item id, but every time it keeps showing the item id,  

This is my modelview item class 

public class EmpleadoViewModel
    {
 
       public int EmpleadoID { get; set; }
         
        [Required]
        public String Nombre { get; set; }
 
        [Required]
        public String Email { get; set; }
 
        [Required]
        public String Activo { get; set; }
 
        [Required]
        public String Role { get; set; }
    }

 This is the grid settings 

@(Html.Kendo().Grid<EmpleadoViewModel>()
               .Name("people_grid")
               .Columns(columns =>
               {
                   columns.Bound(e => e.Nombre).Title("Nombres").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Email).Title("E-Mail").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Activo).Title("Estado").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Role).Title("Rol de sitio").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Command(command =>
                   {
                       command.Edit().Text("Editar").HtmlAttributes(new { @class = "sharp", onmouseover = "editBtnPopover(this)", onmouseout="hidePopover(this)" });
                       command.Custom("Deshabilitar").Click("disablePerson").HtmlAttributes(new { @class = "sharp", onmouseover = "disableBtnPopover(this)", onmouseout = "hidePopover(this)" });
 
                   }).Title("Acciones").HeaderHtmlAttributes(new { style = "text-align:center" });
               })
               .ToolBar(toolbar =>
               {
                   toolbar.Create().Text("Nuevo").HtmlAttributes(new { id="new_btn" });
                   
               })
               .HtmlAttributes(new { style = "height:550px;" })
               .Editable(editable =>
                   editable.Mode(GridEditMode.PopUp).Window(window =>
                   {
                       window.Draggable(false);
                       window.Title("ICS: Personas");
                   }))
               .Scrollable()
               .Sortable()
               .Pageable(pageable =>
               {
                   pageable.Refresh(false);
                   pageable.PageSizes(true);
                   pageable.ButtonCount(5);
               })
                
               .Events(events => events.Change("getSelectedItem"))
               .DataSource(dataSource => dataSource
                   .Ajax()
                    
                   .PageSize(10)
                   .Model(model =>
                   {
                       model.Id(emp => emp.EmpleadoID);
                       model.Field(emp => emp.EmpleadoID).Editable(false);
                   })
                   .Create(update => update.Action("EditingPopup_Create", "Grid"))
                   .Read(read => read.Action("Read_Alpes_Employees", "Demo"))
                   .Update(update => update.Action("EditingPopup_Update", "Grid"))
                   .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
               )
           )

 So far I'm very unhappy with your product, I can't modify certain things and also every time I use telerik it  messes my whole page design!!!! 

 

Boyan Dimitrov
Telerik team
 answered on 28 Sep 2015
2 answers
400 views

I have a hierarchical grid, containing a list of records, with their associated actions.

 When an action is inserted, the data repository will adjust the status of the master record, according to the action type that has been inserted.  This works, however I'm having difficulty refreshing the master grid to reflect the change in status.

I have put a handler on the action grids (the sub grid) save event, however this fires before the database change has been saved, so the change to the master grids data isn't reflected?

 What event can I handle to refresh the master grid once the data has been saved?

The code is:-

 

@(Html.Kendo().Grid<SimpleChangeControl.Models.View_Action>()
                       .Name("ActionsGrid_#=ID#")
                        .Events(e => e.Edit("onSubEdit"))
                       .Columns(columns =>
                       {
                           columns.Bound(o => o.ID).Title("ID");
                           columns.Bound(o => o.ActionType).Title("Type").ClientTemplate("<span>\\#=ActionTypeDescription\\#</span>").Filterable(f => f.UI("actionTypeFilter"));
                           columns.Bound(o => o.Description).Title("Description");
                           columns.Command(command => { command.Edit(); command.Destroy(); });
 
 
                       })
                       .Filterable(f => f
   .Extra(false)
   .Operators(o => o
   .ForNumber(str => str.Clear()
   .IsEqualTo("Equals"))))
                         .ToolBar(commands => commands.Create())
                       .Editable(editable => editable
                   .Mode(GridEditMode.PopUp))
                       .DataSource(dataSource => dataSource
                           .Ajax()
                           .Events(e => e.Error(@<text> function(e){subError(e,"ActionsGrid_#=ID#")} </text>))
                            .Model(m => m.Id(p => p.ID))
                           .PageSize(10)
 
                           .Read(read => read.Action("RD_Actions", "ChangeRequests", new { ChangeRequestID = "#= ID #" }))
 
                           .Create(create => create.Action("InsertAction", "ChangeRequests", new { CRID = "#= ID #" }))
                           .Update(update => update.Action("UpdateAction", "ChangeRequests"))
                           .Destroy(delete => delete.Action("DeleteAction", "ChangeRequests"))
                            
                           )
                           .Filterable()
                           .Events(e=>e.Save("actionSave"))
                           .Pageable(p => p.Refresh(true))
 
                           .ToClientTemplate())

 The handler is:-

 

function actionSave()
   {
      var grid = $('#Grid').data("kendoGrid");
 
       grid.dataSource.read();
   }

 

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 28 Sep 2015
1 answer
363 views

I have a grid defined thusly: 

@Model VendorManagement.Web.Models.RiskExposureViewModel
@using Kendo.Mvc.UI

@(Html.Kendo().Grid(Model.RiskMatrixExposureList)

     .Name("grdRiskMatrix")
     .Columns(columns =>
     {
                                columns.Bound(c => c.RiskUnit).Title("Risk Unit");
                                columns.Bound(c => c.RiskCategory).Title("Risk Category");
                                columns.Bound(c => c.RiskDescription).Title("Short Description");
                            })
                            .Read(read => read.Action("BindRiskMatrixGrid", "Risk"))
                            .Pageable()
)

RiskMatrixExposureList is a List<RiskMatrixExposure>. The grid as defined is throwing the following error in Razor:

"Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type"

 I have the namespace defined in Views/web.config:

 <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="VendorManagement.Web" />
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

 

Thanks for they help!

 

Nikolay Rusev
Telerik team
 answered on 28 Sep 2015
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
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
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?