Telerik Forums
UI for ASP.NET MVC Forum
1 answer
185 views

This is strange because I am pretty sure this had been working in the past...

Have a ComboBox using ComboBoxFor with a model property.  Pretty basic config with server filtering.

On form the model property is being set to the DataTextField of the ComboBox. Shouldn't it be the DataValueField? The value is being set correctly when I add an alert to the onSelect event of the ComboBox and output the Value field.

Dimitar
Telerik team
 answered on 16 Jun 2017
1 answer
421 views
I developed an Editor template which is displayed as a modal/pop-up form used to update row data
values on a grid.  I need to show/hide sections on the form based on the values set on the
dropdownlist.  The show/hide functionality works when the dropdownlist value changes. 

However,  I need to set which sections/panels are hidden when the form initially loads before the page is rendered.
I’ve tried retrieving the selected option value in the $(document).ready() function as illustrated in the
source code I’ve included. However, the value/text is either null or undefined when the ready function is invoked.
After the  $(document).ready() function execution completes,  dropdownlist fields display the data from the grid correctly.

How would I go about retrieving the initial value of the dropdown lists before form is rendered in order to process the logic needed to
show / hide the appropriate sections on the form?


Listed below is source code from my EditTemplate:

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

        <div class="form-group">
            @Html.LabelFor(model => model.StepNumber, htmlAttributes: new { @class = "control-label col-md-2" })
            @Html.EditorFor(model => model.StepNumber)
            @Html.ValidationMessageFor(model => model.StepNumber, "", new { @class = "text-danger" })
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.TaskName, htmlAttributes: new { @class = "control-label col-md-2" })
            @Html.EditorFor(model => model.TaskName)
            @Html.ValidationMessageFor(model => model.TaskName, "", new { @class = "text-danger" })
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.ActionID, htmlAttributes: new { @class = "control-label col-md-2" })
            @(Html.Kendo().DropDownList().Name("ActionIDText").DataValueField("ID").DataTextField("ActionName")    
                        .OptionLabel("--select action--").BindTo((System.Collections.IEnumerable)ViewData["actions"])
                        .Value(Model.ActionIDText))
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.ActionTarget, htmlAttributes: new { @class = "control-label col-md-2" })
            @(Html.Kendo().DropDownList().Name("ActionTarget")
                        .DataValueField("ID")
                        .DataTextField("ActionTarget")
                        .OptionLabel("--select target--")
                        .BindTo((System.Collections.IEnumerable)ViewData["targets"])
                        .Value(Model.ActionTarget))
        </div>
        <div id="UserPanel" style="display:none" class="form-group">
            @Html.LabelFor(model => model.UserID, htmlAttributes: new { @class = "control-label col-md-2" })
            @(Html.Kendo().DropDownList()
                        .Name("UserID").DataValueField("ID").DataTextField("FullName")
                        .OptionLabel("--select User--").BindTo((System.Collections.IEnumerable)ViewData["users"])
                        .Value(Model.UserID) )
        </div>
        <div id="GroupPanel" style="display:none" class="form-group">
                @Html.LabelFor(model => model.GroupID, htmlAttributes: new { @class = "control-label col-md-2" })
                @(Html.Kendo().DropDownList().Name("GroupIDText").DataValueField("ID").DataTextField("GroupName")
                                .OptionLabel("--select group--").BindTo((System.Collections.IEnumerable)ViewData["groups"])
                                .Value(Model.GroupIDText) )
        </div>
        <div id="SupervisorPanel" style="display:none" class="form-group">
                 @Html.Label("Supervisor", htmlAttributes: new { @class = "control-label col-md-2" })
                 @(Html.Kendo().DropDownList()
                        .Name("ManagerID").DataValueField("ID").DataTextField("FullName")
                        .BindTo((System.Collections.IEnumerable)ViewData["users"])
                        .OptionLabel("--select manager --").Value(Model.UserID) )
       </div>
}

<script>
    $(document).ready(function () {
        alert("read....");
        ConfigureIntialPanel();
        alert("done");
    });

    /* Set initial state of Panels  */
    function ConfigureIntialPanel() {

        var target = $("#ActionTarget option:selected").text();
        var targetvalue = $("#ActionTarget option:selected").val();
        alert('target = ' + target + '      targetvalue =' + targetvalue);

        var target2 = $("#ActionTarget").find("option:selected").text();
        var targetvalue2 = $("#ActionTarget").find("option:selected").prop("value");
        alert('target2 = ' + target2 + '      targetvalue2 =' + targetvalue2);

        if (targetvalue == "Individual") {
            $('#UserPanel').show();
            $('#GroupPanel').hide();
            $('#SupervisorPanel').hide();
            /* alert('targetvalue = Individuel   /   Panel = ' + panel); */
        }
        else if (targetvalue == "Group") {
            $('#UserPanel').hide();
            $('#GroupPanel').show();
            $('#SupervisorPanel').hide();
            /* alert('targetvalue = Groupd   /   Panel = ' + panel);  */
        }
        else if (targetvalue == "Supervisor") {
            $('#UserPanel').hide();
            $('#GroupPanel').hide();
            $('#SupervisorPanel').show();
            /*  alert('targetvalue = Super   /   Panel = ' + panel);  */
        }
        else {
            $('#UserPanel').hide();
            $('#GroupPanel').hide();
            $('#SupervisorPanel').hide();
            /* alert('targetvalue = **Unknown   /   Panel =' + panel);  */
        }
    };

</script>

<script>
            $('#ActionTarget').change(function () {
                var target = $('#ActionTarget option:selected').text();
                var targetvalue = $('#ActionTarget').val();
                 var panel = '#' + target + 'Panel';

                 if (targetvalue == "Individual") {
                     $('#UserPanel').show();
                     $('#GroupPanel').hide();
                     $('#SupervisorPanel').hide();
                 }
                 else if (targetvalue == "Group") {
                     $('#UserPanel').hide();
                     $('#GroupPanel').show();
                     $('#SupervisorPanel').hide();
                 }
                 else if (targetvalue == "Supervisor") {
                     $('#UserPanel').hide();
                     $('#GroupPanel').hide();
                     $('#SupervisorPanel').show();
                 }
            });

</script>

Boyan Dimitrov
Telerik team
 answered on 16 Jun 2017
1 answer
2.2K+ views

There seems to be a difference between the files used on our development server and production server. A comparison between the deployed files shows only the expected differences in web.config.

On out development machine there are no Telerik bundles used, but on the production machine there are the following 4 and the all throw 404 errors.

https://cms1.transguardian.com/bundles/kendo/fonts/glyphs/WebComponentsIcons.ttf?gedxeo

https://cms1.transguardian.com/bundles/kendo/images/kendoui.woff?v=1.1

https://cms1.transguardian.com/bundles/kendo/images/kendoui.ttf?v=1.1

https://cms1.transguardian.com/bundles/kendo/fonts/glyphs/WebComponentsIcons.woff?gedxeo

 

There is no Teleik code in our BundleConfig file other than us include the appropriate JS and CSS files. Nothing close the the paths listed above. I have check that we do have woff files that included in the project, but are set as do not copy.

So far we have only noticed the issues on a page that uses a Telerik MVC Grid that has sub grids. The icons to expand and collapse the sub grid are missing.

This happened when we upgraded to 2017.2.504

 

Any ideas as to how to handle this?

Thanks

Randy

Tsvetina
Telerik team
 answered on 16 Jun 2017
2 answers
2.1K+ views

I'm looking to open a popup from a button on a grid row.

The purpose is not really to edit the row data but rather to take the row id (in this case company id) and load a modal with some dropdowns (for selecting/assigning users) and assign those to the company id passed into the modal view.

Is this kind of thing possible? If so, how might I go about starting to implement it?

Can I do it by opening a popup that contains a partialview?

Thanks.

Terry
Top achievements
Rank 1
 answered on 16 Jun 2017
1 answer
121 views

Hi,

When I browse to a certain page in my project with a Kendo Grid inside, I'm having a little issue. The grid is shown not visually styled momentarily when the page is loaded. It's just a little "flash" of it, and then it's rendered appropriately. Any idea how to fix this?

Stefan
Telerik team
 answered on 16 Jun 2017
1 answer
100 views

I have an ASP.NET MVC application and it has a page that makes use of the KendoGrid:

$(function () {
        $("#Grid").kendoGrid({
            columns: [
                        { "title": "Straat", "field": "Straat" },
                        { "title": "Huisnummer", "field": "Huisnummer" },
                        { "title": "Volledige Naam", "field": "VolledigeNaamKoperHuurder" },
                        { "title": "Plaats", "field": "Plaats" },
                        { "title": "Objectsoort", "field": "Objectsoort" },
                        { "title": "Objectcode", "field": "Objectcode" }],
            dataSource: {
                transport: {
                    read: "/bouwobject/getbouwobjectenjson",
                    dataType: "json"
                },
                pageSize: 15
            },
            selectable: "row",
            scrollable: false,
            pageable: {
                messages: {
                    display: "{0} - {1} van {2} items",
                    empty: "Geen items te tonen",
                    page: "Pagina",
                    of: "van {0}",
                    itemsPerPage: "items per pagina",
                    first: "Ga naar de eerste pagina",
                    previous: "Ga naar de laatste pagina",
                    next: "Ga naar de volgende pagina",
                    last: "Ga naar de laatste pagina",
                    refresh: "Verversen"
                }
            },
            sortable: { mode: "single" },
            filterable: {
                messages: {
                    info: "Toon items met waarde",          // sets the text on top of the filter menu
                    filter: "Filter",                       // sets the text for the "Filter" button
                    clear: "Opheffen",                      // sets the text for the "Clear" button

                    // when filtering boolean numbers
                    isTrue: "is waar",                      // sets the text for "isTrue" radio button
                    isFalse: "is onwaar",                   // sets the text for "isFalse" radio button

                    // changes the text of the "And" and "Or" of the filter menu
                    and: "En",
                    or: "Of"
                },
                operators: {
                    // filter menu for "string" type columns
                    string: {
                        eq: "Is gelijk aan",
                        neq: "Is ongelijk aan",
                        startswith: "Start met",
                        contains: "Bevat",
                        ncontains: "Bevat niet",
                        endswith: "Eindigt met"
                    },
                    // filter menu for "number" type columns
                    number: {
                        eq: "Is gelijk aan",
                        neq: "Is ongelijk aan",
                        gte: "Is groter dan of gelijk aan",
                        gt: "Is groter dan",
                        lte: "Is kleiner of gelijk aan",
                        lt: "Is kleiner dan"
                    },
                    // filter menu for "date" type columns
                    date: {
                        eq: "Is gelijk aan",
                        neq: "Is ongelijk aan",
                        gte: "Is na of op",
                        gt: "Is na",
                        lte: "Is op of voor",
                        lt: "Is voor"
                    },
                    // filter menu for foreign key values
                    enums: {
                        eq: "Is gelijk aan",
                        neq: "Is ongelijk aan"
                    }
                }
            },
            groupable: {
                messages: {
                    empty: " Verplaats de titel van een kolom hier naar toe om te groeperen op die kolom"
                }
            }
        });
    });

This grid is on a page where there is a button where the user can navigate to a new page. This page has a form, and once filled in and submitted stays on that page. The user then can click a button to go back to the page with the grid. Now, on my machine this grid is updated with some of the values the user just filled in the form. When deployed at the client, this does not happen. The use has to refresh the page with the grid for the values to come up.

What is happening?

Stefan
Telerik team
 answered on 16 Jun 2017
3 answers
524 views

I need to make a Custom Toolbar button mesh in with the other 2 buttons. 

(See attachment and code)

.ToolBar(tools =>
{
 tools.Custom().Text("Print this Page").Name("PrintPage").Url("#").HtmlAttributes(new { @class = "export-img" });
                   tools.Pdf().Text("Export all records to PDF");
                   tools.Excel().Text("Export all records to Excel");
}
 )

 

I have tried to apply CSS just can't get the ".Custom()" to take effect.

Suggestions?

Thanks

 

 

 

Georgi
Telerik team
 answered on 15 Jun 2017
13 answers
3.1K+ views
Having trouble implementing MultiSelectFor and binding to remote data.

                                @(Html.Kendo().MultiSelectFor(model => model.Solutions)
                                    .DataSource(dataSource => dataSource
                                        .Read(read => {read.Action("GetSolutionNames", "Editor");
                                            read.Type(HttpVerbs.Post);})
                                        .ServerFiltering(false)
                                    )
                                    .AutoBind(false)
                                    .Placeholder("Select solutions...")                        
                                )

model.Solutions is a List<string>
The GetSolutionNames() Method in the controller simply returns a List<string>

Nothing is being passed back to the controller on submit.
Are there any examples of MultiSelectFor?

Documentation isn't great.
Dhruv
Top achievements
Rank 1
 answered on 14 Jun 2017
1 answer
167 views

Hi,

I've create a task sheduler. Read and create are working fine ( data are created in database with a generated Guid: oid) but when I try to update my task I've got an Internal error 500 visible on my Chrome developper console. In effect No data are sent !

Did I forgot something?

Please see my code:

@(Html.Kendo().Scheduler<Elearning.ViewModels.TasksViewModel>()
.Name("scheduler")
.Date(DateTime.Today)
.StartTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 6, 0, 0))
.DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd/M')#</span>")
.Height(480)
.Views(views =>
{
    views.DayView();
    views.WorkWeekView(workWeekView => workWeekView.Selected(true));
    views.WeekView();
    views.MonthView();
    //views.AgendaView();
    //views.TimelineView();
})
        .Resources(resource =>
        {
            resource.Add(m => m.CoursID)
                .Title("Leçon")
                .DataTextField("Text")
                .DataValueField("Value")
                .DataColorField("Group.Name")
                .BindTo(Model.Lessons);
        })
                .DataSource(d => d
                    .Model(m => {
                        m.Id(f => f.oid);
                        m.Field(f => f.oid).DefaultValue(new Guid());
                        m.Field(f => f.Title);
                        m.Field(f => f.Start);
                        m.Field(f => f.End);
                        m.Field(f => f.StartTimezone);
                        m.Field(f => f.EndTimezone);
                        m.Field(f => f.IsAllDay);
                        m.Field(f => f.Description);
                        m.Field(f => f.RecurrenceRule);
                        m.Field(f => f.RecurrenceException);
                        m.Field(f => f.RecurrenceID);
                        m.Field(f => f.UtilisateurID).DefaultValue(UserContext.CurrentUser.oid);
                        m.Field(f => f.CoursID);
                    })
                  .Read("Read", "Tasks")
                  .Create("Create", "Tasks")
                  .Update("Update", "Tasks")
                  .Destroy("Destroy", "Tasks")
                  )
   
            )
Plamen
Telerik team
 answered on 14 Jun 2017
30 answers
4.4K+ views
Hello,
Can i customize the default buttons for CRUD operations(add,delete,edit) ?for example remove or change text,add only a custom image,add a tooltip.something just like   the Grid RadControl where i can customize all that.

Regards,
Daniel
Dimo
Telerik team
 answered on 14 Jun 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?