Telerik Forums
UI for ASP.NET MVC Forum
4 answers
678 views

I have a gantt control on a page. The toolbar has to have a similar button like the AddTask when clicking on it a context menu should appear.

The gantt configuration looks like this

@(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
    .Name("gantt")
    .Toolbar(tb =>
    {
       tb.Add().Name("append");
       tb.Add().Name("pdf");
       tb.Add().TemplateId("expandCollapseTemplate");
    })

And the template like this

<script id="expandCollapseTemplate" type="text/x-kendo-template">
   <a class="k-button expandbutton"><span class="k-icon"></span>Expand/Collapse</a>
   @(Html.Kendo().ContextMenu()
        .Name("expandMenu")
        .Filter(".expandbutton")
        .CloseOnClick(true)
        .Direction(ContextMenuDirection.Bottom)
        .OpenOnClick(true)
        .ShowOn("click")
        .Items(items =>
        {
           items.Add().Text("Expand Parent");
           items.Add().Text("Expand all");
           items.Add().Text("Collapse all");
        })
        .ToClientTemplate()
        )
</script>

However I get an exception:

Unhandled exception at line 25, column 7809 in http://localhost:56541/Scripts/kendo.all.min.js
0x800a139e - JavaScript runtime error: Invalid template:'<button class="k-button k-button-icontext k-gantt-create" type="button" data-action="add"><span class="k-icon k-i-plus"></span><span>Add Task</span></button><button class="k-button k-button-icontext k-gantt-pdf" type="button" ><span class="k-icon k-i-file-pdf"></span><span>Export to PDF</span></button>
   <a class="k-button expandbutton"><span class="k-icon"></span>Expand/Collapse</a>
   <ul class="k-widget k-reset k-header k-menu k-context-menu k-menu-vertical" id="expandMenu"><li class="k-item k-state-default"><span class="k-link">Expand Parent</span></li><li class="k-item k-state-default"><span class="k-link">Expand all</span></li><li class="k-item k-state-default"><span class="k-link">Collapse all</span></li></ul><script>
kendo.syncReady(function(){jQuery("#expandMenu").kendoContextMenu({"direction":"bottom","openOnClick":true,"filter":".expandbutton","showOn":"click"});});
</script>
' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='<button class="k-button k-button-icontext k-gantt-create" type="button" data-action="add"><span class="k-icon k-i-plus"></span><span>Add Task</span></button><button class="k-button k-button-icontext k-gantt-pdf" type="button" ><span class="k-icon k-i-file-pdf"></span><span>Export to PDF</span></button>\n   <a class="k-button expandbutton"><span class="k-icon"></span>Expand/Collapse</a>\n   <ul class="k-widget k-reset k-header k-menu k-context-menu k-menu-vertical" id="expandMenu"><li class="k-item k-state-default"><span class="k-link">Expand Parent</span></li><li class="k-item k-state-default"><span class="k-link">Expand all</span></li><li class="k-item k-state-default"><span class="k-link">Collapse all</span></li></ul><script>\n\tkendo.syncReady(function(){jQuery("';expandMenu").kendoContextMenu({"direction":"bottom","openOnClick":true,"filter":".expandbutton","showOn":"click"});});
</script>
;$kendoOutput+=;}return $kendoOutput;'

I have used the same template on a grid and no exception was thrown. 

The telerik version that I tested was with 2018.1.221.545. Was this issue fixed in the latest version or what am I doing wrong?

 

Dan
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 24 May 2018
20 answers
579 views

Hey Telerik team .

i'm using Telerik Gantt Chart. it's great really awesome.

I have a requirement to add my custom Recources dialog in the Gantt chart or populate existing resources dialog based on the StartDate and EndDate of the selected task.

when dialog is open to assign resources to task based on the StartDate and EndDate of the selected task the resources dialog will be populated after checking from the server that is the resources are available on the  selected DateTime or not. if available then all will be in the dialog box to be selected as a assignee which are not available on that date will not be there in the list !

is that possible in this gantt chart with the existing resources dialog or not ? or is this possible to use my own resource dialog box and do all this stuff ?

please let me know.

Thankyou.

Regards: Nabil Nawaz

Nencho
Telerik team
 answered on 23 May 2018
13 answers
1.5K+ views

Hi,

i am facing issue with Kendo Combo boxes, where the Change event is getting fired two times, please find the below code.

<table>
                            <tr id="controls">
                                <td>
                                    <label id="lbl1">Config Type:</label>
                                </td>
                                <td>

                                    @(Html.Kendo().ComboBox()
                                        .Name("cmb_configType")
                                        .HtmlAttributes(new { @class = "fieldentertext", required = "required", style = "width:85%;", validationmessage = "" })
                                        .Placeholder("Select Config Type...")
                                        .DataTextField("ConfigTypes")
                                        // .DataValueField("Names")
                                        .Filter(FilterType.Contains)

                                                .Events(e =>
                                                {
                                                    e.Change("OnChange_ConfigType");
                                                    //.Select("OnSelect_Config")
                                                    //.Open("OnOpen_Config")
                                                    //.Close("OnClose_Config")
                                                    //.DataBound("OnDataBound_Config")
                                                    //.Filtering("OnFiltering_Config");
                                                })
                                                                            )


                                </td>
                                
                                <td>
                                    <label id="lbl3">Config Name:</label>
                                </td>
                                <td>
                                   
                                    @(Html.Kendo().ComboBox()
                                .Name("cmb_confignames")
                                .HtmlAttributes(new { @class = "fieldentertext", required = "required", style = "width:85%;", validationmessage = "" })
                                .Placeholder("Select Config Name...")
                                .DataTextField("ConfigNames")
                                // .DataValueField("Names")
                                .Filter(FilterType.Contains)

                                        .Events(e =>
                                        {
                                            e.Change("OnChange_ConfigNames");
                                            //.Select("OnSelect_Config")
                                            //.Open("OnOpen_Config")
                                            //.Close("OnClose_Config")
                                            //.DataBound("OnDataBound_Config")
                                            //.Filtering("OnFiltering_Config");
                                        })
                                                                    )
                                </td>
                                <td>
                                    <button class="btn-brdr" id="btnctrl">+</button>
                                </td>
                                
                            </tr>
                        </table>

 

i am creating two combo boxes 1. Config Type 2. Config Name

when user clicks on first combo, based on the selection i am loading data to second combo box.

when User clicks on Second Combo box(Config Name), It is firing the event for(Config Type) once again and then it is firing event for(Config Name), Why it is firing event for First combo box, when i select on Second combo box?

And also i observed that, if i click on any where in the page these two events are firing, What is wrong in this code?

Here are my fucntions which gets hit on event.

function OnChange_ConfigType(obj)

{

---------------------

}

function OnChange_ConfigName(obj)

{

--------------------

}

 

Please help on this.

 

pogula
Top achievements
Rank 1
 answered on 23 May 2018
1 answer
567 views
In other components like the Menu, there is the Encode(false) and/or Encoded(false) option. I cannot find it in ButtonGroup. How do I customize the icons? The default Font Icons provided do not contain any business or currency related icon sub-set.
Joana
Telerik team
 answered on 22 May 2018
16 answers
2.3K+ views
Hey,

I have a grid in master/detail like below.

CourseVM has an "Id" property as primary key (int)

As you can see, the detail grid uses a popup editor (custom editortemplate defined in /shared/EditorTemplates/CourseEntryVM.cshtml).

On that custom popup editor template, I need to have access to the master id (from CourseVM) in order to do some filtering for a dropdownlist, but I don't know how to have that Id.

Can anyone help me ?

Thanks

@(Html.Kendo().Grid<CourseVM>()
    .Name("CourseGrid")
    .DataSource(ds => ds
        .Ajax()
        .Events(events => events.Error("courseGridError"))
        .Model(model => model.Id(o => o.Id))
        .Read(read => read.Action("Course_Read", "Course"))
        .Destroy(destroy => destroy.Action("Course_Destroy", "Course"))
        .ServerOperation(false)
)
    .Columns(columns =>
    {
        columns.Bound(c => c.Id).Hidden();
        columns.Bound(c => c.Number);
        columns.Bound(c => c.OrganisationDisplay);
        columns.Bound(c => c.BeginDate);
        columns.Bound(c => c.EndDate);
        columns.Command(commands =>
        {
            commands.Custom("Aanpassen").Click("courseEdit");
            commands.Destroy().Text("Verwijderen");
        }).Title("Commands").Width(200);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Custom().Text("Nieuwe cursus inrichten").Action("Create", "Course");
    })
    .Pageable()
    .Sortable()
    .ClientDetailTemplateId("courseDetailTemplate")
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
    )
 
    <script id="courseDetailTemplate" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=Id#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Inschrijvingen").Content(
                    @<text>
                        @(Html.Kendo().Grid<CourseEntryVM>()
                                .Name("entryGrid_#=Id#")
                                .Columns(columns =>
                                {
                                    columns.Bound(c => c.StudentDisplay);
                                    columns.Bound(c => c.EntryDate);
                                  })
                                  .DataSource(dataSource => dataSource
                                      .Ajax()
                                      .Model(model =>
                                      {
                                          model.Id(c => c.StudentPersonAccountId);
                                      })
                                      .PageSize(30)
                                      .Read(read => read.Action("Entry_Read", "Course", new { courseId = "#=Id#" }))
                                      .Create(create => create.Action("Entry_Create", "Course", new { courseId = "#=Id#" }))
                                      .ServerOperation(false)
                                  )
                                  .ToolBar(toolbar =>
                                  {
                                      toolbar.Create().Text("Inschrijving toevoegen");
                                  })
                                  .Editable(editable => editable.Mode(GridEditMode.PopUp))
                                  .Pageable()
                                  .Sortable()
                                  .Events(events => events.Save("entryGridSaving"))
                                  .ToClientTemplate())
                    </text>
                    );
            })
                                    .ToClientTemplate()
        )
    </script>
Stefan
Telerik team
 answered on 22 May 2018
2 answers
116 views

Hi,

The snippet in the dojo link below works fine in Chrome.

In firefox the input field vanishes.  I think this has something to do with the float of the two panes, I need this as it is part of the site design.

http://dojo.telerik.com/OGazIYiQ/2

 

Can anyone help?

 

 

Thanks.

Preslav
Telerik team
 answered on 21 May 2018
1 answer
12.7K+ views
Hi Team,

I'd like to know how the column headers in a grid may be hidden. The effect I wish to achieve is something like the following:

Instead of:

Order ID        Employee                Ship Address
10251            Janet Leverling        2, rue du Commerce
10252            Margaret Peacock    Boulevard Tirou, 255

I wish to make my grid look like:

10251             Janet Leverling         2, rue du Commerce
10252             Margaret Peacock     Boulevard Tirou, 255

Just the same thing, but without the headers. Please let me know how to achieve this.
Stefan
Telerik team
 answered on 21 May 2018
1 answer
1.4K+ views

I'm trying to create a custom number format for a bound column using MVC/Grid like you see in Excel where you have a positive;negative;zero formats  I keep getting errors this is what I've tried:

.ClientTemplate("#= kendo.toString(RegularTimeHours, '##,##0.00;(##,##0.00);-' ) #")

.ClientTemplate("#= kendo.toString(RegularTimeHours, '{0:##,##0.00;(##,##0.00);-}' ) #")

 

Could I get some direction on how to do this?

Thanks

Lee

Stefan
Telerik team
 answered on 21 May 2018
2 answers
2.3K+ views

The MultiSelect-control is bound to a list of strings and it's required that the user select exactly four items.

How can I validate that with Kendo Validator or ASP.Net Validation?

I have also tried to use the Required annotation on the model property, but only that doesn't work.
Neither do the Range-keyword since it only works for numeric fields.

 

Johan
Top achievements
Rank 1
 answered on 19 May 2018
3 answers
647 views

HI I have asp.net mvc application with below telerik grid whcih i want to bind with asp.net webapi hosted on IIS. i can't find any ecample where to put the webapi url and how weapi's controller is invoked. please help in responding to this

 

 @(Html.Kendo().Grid<TelerikMvcApp131.Models.DeviceDetailsChild>()
                        .Name("webapi_grid")
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.person).Title("ID").Width(100);
                         
                            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                        })
                        .ToolBar(tools =>
                        {
                            tools.Create();
                        })
                        .Sortable()
                        .Pageable()
                        .Filterable()
                        .DataSource(dataSource =>
                            dataSource
                            .WebApi()
                            .Model(model =>
                            {
                                model.Id(p => p.Network);
                            })
                            .Events(events => events.Error("error_handler"))
                            .Read(read => read.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "product" })))
                     
                        )
                    )

 

Where should i define DefaultApi inside asp.net mvc application (note DefaultApi is defined inside webapi already)

Boyan Dimitrov
Telerik team
 answered on 18 May 2018
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
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?