Telerik Forums
UI for ASP.NET MVC Forum
13 answers
1.3K+ 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
464 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.1K+ 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
83 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.2K+ 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.3K+ 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.1K+ 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
573 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
1 answer
592 views

So I pass in a model list of objects into my view, I reference this in my foreign key column and use filterable.UI to link to a separate function to control the filter. But when I try to do this the grid ignore my .Filterable options and uses the data from my Model.List to populate the filter, this is not the case with a non-foreign key column.

Does anyone know how to use custom filter options with a foreign key column in a kendo grid?

Tsvetina
Telerik team
 answered on 17 May 2018
1 answer
124 views

Using MVC; How do I get the labels (months)  to dynamically align at the bottom of the chart (see attached image) when values are negative?

I have tried:

.Labels(labels => labels.Padding(80, 0, 0, 0))

but it changes the scale of my chart if there are no negative values.

Stefan
Telerik team
 answered on 17 May 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?