Telerik Forums
UI for ASP.NET MVC Forum
5 answers
816 views

Hi there guys and gals. There appears to be a problem with bool field(check box) in kendo grid. When you click on a bool field, a check box appears and when you click on the check box to change it from true to false and vice versa, it doesn't  change. But when you click on the check box field and then press the space bar, then it changes. This is probably a bug. 

example, try changing the Discontinued field in the grid

Konstantin Dikov
Telerik team
 answered on 14 Dec 2017
5 answers
1.9K+ views

Hi I have issue with displaying dropdownlist [object object]. I tried everyway and even followed some solution in this issue but none worked. Its simple SelectListItem Bind to dropdownlist. Value is loading without any list. when you click it it displays the list but when you select the list item nothing changed and remain as loaded displaying [Object Object]. but how ever Developer toolls shows Dropdownlist value and text field values. Could you please kindly tell me why and where I am wrong. I am new to Kendo but OK with MVC I have used all other dropDownList using Html helper methods even using models, Enums etc. but why this simple Vlaue, text list is not displaying and selecting. but loading perfectly. Please I am really stuck with other places as well with different kendo grid bind to different tables. Please note I am using ADO.NET and stored Proc to retrieve data as I am migrating to MVC. Please see attached images as well. Hope someone will give me solution to this burning issues. -Please note in my Drondownlist editor template, when I used read metid (Line 14 - 17) I get list as 'undefined' without displaying [object object]. its again same SelectListItem only thing is I manually bind to datasource via read method. Do i have to do anything in DropDownChnage event. 

 

My Grid View. 

 

_CategiryGrid.cshtml
 
@model  IEnumerable<StB.ViewModels.CategoryViewModel>
@{
    var imagePath = "~\\Content\\images\\Info.gif";
}
 
@*//   Ajax Grid //   *@
@*@(Html.Kendo().Grid(Model).Name("CategoryGrid")*@
@(Html.Kendo().Grid<StB.ViewModels.CategoryViewModel>().Name("CategoryGrid")
            .Columns(columns =>
            {
                columns.Bound(c => c.ClientCode).Hidden(true);
                columns.Bound(c => c.Category).ClientGroupHeaderTemplate("Category: " + "#= value#").Width(60);
                columns.Bound(c => c.Attribute).Title("Attribute").Width(100);
 
                columns.Bound(c => c.Description).Width(150); //.ClientTemplate(@"<div><img id='tooltipIconItem' src='@imagePath' ToolTip =#:data:ToolTip# /></div>" + @"<div> @Html.Label('fieldValueItem', #:data:Description#)</div>");
 
                columns.Bound(c => c.Required).Width(30); //.ClientTemplate(@"<div><img id='reqEdit' src='~\\Content\\images\\RedStar.gif' /></div>");
 
                columns.Bound(c => c.FieldType).Hidden(true);
                columns.Bound(c => c.DomainID).Hidden(true);            
                columns.Bound(c => c.AttrType).Hidden(true);
                columns.Bound(c => c.Tooltip).Hidden(true);
                columns.Bound(c => c.FieldValue).Width(80).Title("Value").EditorTemplateName("FieldValueEditor").ClientTemplate("#:FieldValue #")
                .HtmlAttributes(new { id = "ddlFieldvalues" }); //.EditorTemplateName("FieldValueEditor");
 
            })
            .Editable(editabel => editabel.Mode(GridEditMode.InCell).Enabled(true))
             .Navigatable()
             .Scrollable()
            .Groupable()
            .Sortable()
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Cell))
            .AutoBind(false)
            .Pageable(pageable => pageable
               
                .ButtonCount(2))
 
           .DataSource(datasource => datasource
               .Ajax()
               .Read(read => read.Action("DisplayGridData", "HierarchyBuilder").Type(HttpVerbs.Post))
               .Update(update => update.Action("UpdateCategory", "HierarchyBuilder"))
               .ServerOperation(false)
               .Batch(true)
               .PageSize(60)
               .Model(model => model.Id(p => p.Attribute))
                   .Model(model =>
                   {
                       model.Field(f => f.Category).Editable(false);
                       model.Field(f => f.Attribute).Editable(false);
                       model.Field(f => f.Description).Editable(false);
                       model.Field(f => f.Required).Editable(false);
                       model.Field(f => f.FieldValue).Editable(true).DefaultValue("1");
 
                   })
               .Aggregates(aggregates => { aggregates.Add(p => p.Category == p.Category).Count(); })
               .Group(groups => groups.Add(m => m.Category))
 
               )
                       .Events(events => { events.Edit("onCategoryGridEdit").DataBound("onCategoryGridDataBound").Change("onCategoryGridChange"); })
       
)
 
@Html.Hidden("ClientCode", HttpContext.Current.Session["ClientCode"])

 

Model for Grid

CategoryViewModel
 
 public class CategoryViewModel
    {
        
        public string OrgCode { get;set;}
        public string SiteCode {get;set;}
 
        public string ClientCode { get; set; }
        public string StructureCode { get; set; }
        public string Category { get; set; }
        public string Attribute { get; set; }
        public string Description { get; set; }
 
        [UIHint("FieldValueEditor")]
        public string FieldValue { get; set;}
 
        public string AttrType { get; set; }
        public string Required { get; set; }
        public int FieldType { get; set; }
        public string DomainID { get; set; }
        public string Tooltip { get; set; }
 
        public IList<DomainViewModel> AllDomains { get; set; }
    }

 

Controller Action method (this is where I get drodowlist as SelectListiem list. I initially directly bound to Domain List and it displays list prefectly but with [object object]. Then I changed to SelectList by creating SelectListItem by reading Domain Model and loading Vlaue text into SelectListItem. I bound to SelectList. Results exactly same. then Finally I chnaged to SelectListItem as show by kendo documentation. Its very simple text value list. and my Grid FieldVlaue in categoryViewModel is string value. 

Below is my controller method 

public IEnumerable<SelectListItem> LoadDropDownlistForValueField(string type, string Client, bool required, string CurrentVal)
       
        {
            StB.DAL.Domain domainRepo = new DAL.Domain();
            List<StB.Models.Domain> domains = new List<Models.Domain>();
            domains = domainRepo.GetDomainValueList(type, Client, CurrentVal, required);
 
            SelectListItem sli = null;
            List<SelectListItem> selectlists = new List<SelectListItem>();
            foreach (var d in domains)
            {
                sli = new SelectListItem() { Text = d.ShortDescription, Value = d.Value, Selected = d.Value == CurrentVal };
                selectlists.Add(sli);
            }
            
 
            ViewData["FieldValueList"] = selectlists;
            return (System.Collections.Generic.IEnumerable<SelectListItem>)ViewData["FieldValueList"];
        }

 

 

below is my DropDownList editor template for my Grid column.

01.@(Html.Kendo().DropDownList()
02.            .Name("FieldValue")     
03.            .HtmlAttributes(new { id = "ddlFieldValues" })           
04.            .ValuePrimitive(true)       
05.            .DataTextField("Text")
06.            .DataValueField("Value")
07. 
08.            .AutoBind(false)
09. 
10.            .Events(e => e.Change("onFiledVaueDropDownChange").DataBound("onFiledVaueDataBound"))
11. 
12.                .BindTo((IEnumerable<SelectListItem>)ViewData["FieldValueList"])
13. 
14.                //.DataSource(datasource =>
15.                //{
16.                //    datasource.Read(read => read.Action("LoadDropDownlistForValueField", "HierarchyBuilder").Data("additionalInfo('CategoryGrid')"));
17.                //})
18. 
19.)

 

 

Dimitar
Telerik team
 answered on 13 Dec 2017
2 answers
493 views

Hi,

I am trying to change the ItemTemplate for a Multiselect which is used inside a CustomEditorTemplate for a Kendo Scheduler. 

The multiselect is initialized as follows:

<code>

@(Html.Kendo().MultiSelectFor(model => model.Predavatelji_Ids)

          .HtmlAttributes(new { data_bind = "value:Predavatelji_Ids" })
          .Name("Predavatelji_Ids")
          .DataValueField("Id")
          .DataTextField("Ime")
          .Filter("contains")
          .AutoBind(true)
          //.Value(Model.Predavatleji)

          .DataSource(source =>
          {
              source.Read(read =>
                  read.Action("Avtorji_Dropdown", "Avtorji").Data("additionalInfo")
                  )
                .ServerFiltering(true);
          }).Events(e => e.Open("validatePredmentInput"))
           .ItemTemplate("<span class=\"k-state-default\"><h3>#: console.log(data) #</h3><p>#= data.Ime #</p></span>")
    )

</code>

But calling the data object inside the ItemTemplate returns the Model object for the current Scheduled event and not the Multiselect item.

What am I missing?

 

Dimitar
Telerik team
 answered on 13 Dec 2017
4 answers
288 views

Hello,

I'm using remote data binding. If I return Json(listNodes) everything works as expected, but if it is Json(listNodes.ToDataSourceResult(request, ModelState)), a "e.slice is not defined" javascript error is thrown.

 

It would be nice to have a DataSourceResult, so I can add errors to the modelstate and handle them in the .Error() method on the client. Or is there any other way to return an error to the TreeView if data fetching fails serverside?

Jan
Top achievements
Rank 1
 answered on 13 Dec 2017
2 answers
98 views

Good morning,

As you can see in the pictures attached, we have created a new project in Visual Studio from your template (Telerik C# ASP .NET MVC Framework 4.5 - Grid and menu). When we launch the project, we apply two filters in two different columns and the browser shows an error. This functionally doesn't work even at the demo pages. We are working with Chrome browser and "Progress® Telerik® UI for ASP.NET MVC" 2017.3.1018.

 

We cant implement in our project a grid with filter-sort-paging server feature (in a MVC controller). Any suggestions?

 

Thanks a lot

 

Francisco
Top achievements
Rank 1
 answered on 13 Dec 2017
5 answers
1.1K+ views

I have a Grid with a command button that open a Dialog. This dialog has a Tabstrip with each tab loading content from a controller that returns a view. The tabstrip is built using the ASP.Net MVC Html wrapper. 

<p>@(Html.Kendo().Dialog()<br>        .Name("viewDetailsDialog")<br>        .Title("Details")<br>        .Content(<br>            Html.Kendo().TabStrip()<br>                .Name("viewDetailsTabstrip")<br>                .Items(tabstrip => {<br>                    tabstrip.Add().Text("Tab 1")<br>                            .HtmlAttributes(new { @class= "tab_bar" })<br>                            .Selected(true)<br>                            .LoadContentFrom("Tab1Content", "MyController");<br><br>                    tabstrip.Add().Text("Tab 2")<br>                            .HtmlAttributes(new { @class = "tab_bar" })<br>                            .Selected(false)<br>                            .LoadContentFrom("Tab2Content", "");<br><br>                   )<br>                .ToHtmlString()<br>            )<br>        .Closable(true)<br>        .Width(900)<br>        .Height(600)<br>        .Modal(true)<br>        .Visible(false)</p><p></p><p></p>

 

The dialog is opened via a JS function that's called by the Grid's Custom Command button. The details that need to be displayed in each tab in the dialog is unique to the row.

 

How do I modify the LoadContentFrom URL and pass query string parameters that are picked by the Tab1Content method on MyController?

Dimitar
Telerik team
 answered on 13 Dec 2017
3 answers
881 views

Hi All.

I am new to using the Telerik controls. I am exploring using the Grid Control and have figured out how to codoe popup window to create a new record.

The following code works below for the first Create button on the toolbar. On the grid toolbar - I want to have two "Create" buttons (see code below). I want  both buttons to implement "Create" but  displays a different custom popup form for each button.

 Is there a way to implement a conditional "Create"? What is the best approach to implement this functionality?

Thank you,

Debby

 

<div id="divGridUser">
@(Html.Kendo().Grid(Model)
.Name("GridTest")
.Columns(columns =>
{
columns.Bound(p => p.UserId);
columns.Bound(p => p.UserType);
columns.Bound(p => p.UserName).Title("User Name");
columns.Bound(p => p.Provider).Title("Provider");
})
.ToolBar(toolbar =>
{
toolbar.Create().Text("Add Provider To Role").HtmlAttributes(new { id = "Provider"});
toolbar.Create().Text("Add  Inside User Role");
})
.Editable(et => et.Mode(GridEditMode.PopUp).TemplateName("Users_Command"))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model => model.Id(p=>p.UserId))
.Read(read => read.Action("UsersCommand_Read", "Popup"))
.Create(upd => upd.Action("UsersCommand_Create", "Popup"))
)
.HtmlAttributes(new { style = "height:550px;" })
.Pageable(pageagble => pageagble.Input(true).Numeric(false))
.Sortable()
.Filterable()
.Scrollable(scr => scr.Endless(true))
)
</div>

Kevin
Top achievements
Rank 1
 answered on 12 Dec 2017
11 answers
3.7K+ views

Hello,

I am facing an issue with the TabStrip (Q2 2015). Here is the declaration:

01.@(Html.Kendo().TabStrip()
02. .Name("documents")
03. .Scrollable(false)
04. .Items(tabstrip =>
05. {
06.tabstrip.Add().Text("Documents")
07. .Selected(true)
08. .LoadContentFrom("LoadDocumentsTabView", "Documents");
09. 
10.                                    tabstrip.Add().Text("Marketing Material")
11. .LoadContentFrom("LoadMarketingMaterialTabView", "Documents", new { area = "Documents");
12. 
13.tabstrip.Add().Text("Contracts Agreements")
14. .LoadContentFrom("LoadContractsAgreementsTabView", "Documents");
15. })
16. )

Let's focus on the first tab, which is "Documents". This is the method called on the controller:

1.public PartialViewResult LoadDocumentsTabView()
2.{
3.    return PartialView("~/Areas/Documents/Views/Tabs/_Documents.cshtml");
4.}
 This partial view is composed of some partial views, and some of these partial views are also calling some partial views. So I have multiple levels of partial views.

 The problem with this is that the TabString doesn't show anything. When I set breakpoints in my controllers, everything is called as expected.

 Am I missing a configuration somewhere?

 

Thanks for any help.

Ivan Danchev
Telerik team
 answered on 12 Dec 2017
1 answer
983 views

Hi, 

I'm very new to kendo and I've been having issues finding some documentation for this. Basically I have the following grid:

@(Html.Kendo().Grid<SylectusTL.Models.User.User>()
                .Name("UserList")
                .Columns(columns =>
                {
                    columns.Bound(c => c.user_name).Title("User Name");                    
                    columns.Bound(c => c.full_name).Title("Name");
                    columns.Bound(c => c.main_phone).Title("Phone");
                    columns.Bound(c => c.email).Title("E-Mail");
                    columns.Bound(c => c.admin).Title("Admin");
                    columns.Bound(c => c.active).Title("Active");
                    columns.Bound(c => c.last_login).Title("Last Login").Format("{0:MM/dd/yyyy}");
                })
                .Pageable(pageable => pageable
                    .Refresh(true)
                    .PageSizes(new int[] { 10, 20, 50 })
                    .ButtonCount(5))
                .Sortable()
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Users_Read", "Account"))
                )
                )

 

What I would like to do is make the user name a link that calls my controller and passes the user id to it. I'm having issues finding a way to use the models user_name parameter for the link text and the models user_id parameter in the url.

 

Georgi
Telerik team
 answered on 12 Dec 2017
5 answers
2.2K+ views

See attached, how do I prevent these from being generated?

The only thing in each folder is "Kendo.Mvc.resources.dll" and I have no need for localization in this project

Ianko
Telerik team
 answered on 12 Dec 2017
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
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?