Telerik Forums
UI for ASP.NET MVC Forum
1 answer
1.6K+ views
I can't seem to get the change event to fire. 

Here's the code:

<div class="k-edit-label">
    @(Html.LabelFor(model => model.IsAllDay))
</div>
<div data-container-for="isAllDay" id="is-all-day" class="k-edit-field">
    <input data-bind="checked: isAllDay" data-val="true" id="isAllDay" name="isAllDay" type="checkbox" />
</div>

I've tried:

$(function () {
    $("#isAllDay").change(function () {
        alert("changed changed");
    });
});

and

<div class="k-edit-label">
    @(Html.LabelFor(model => model.IsAllDay))
</div>
<div data-container-for="isAllDay" id="is-all-day" class="k-edit-field">
    <input data-bind="checked: isAllDay, events: { change: isAllDayChanged}" data-val="true" id="isAllDay" name="isAllDay" type="checkbox" />
</div>
function isAllDayChanged() {
    alert("changed");
}

What am I missing?
Vladimir Iliev
Telerik team
 answered on 12 Sep 2014
4 answers
120 views
Hi,

I would like to use the scheduler control to create a perpetual week calendar.
I would be a full week without dates.
Then I don't need all the buttons around the calendar.

Is that possible ?

Regards,

David
David
Top achievements
Rank 1
 answered on 11 Sep 2014
19 answers
768 views
Hi All.  Trying to use Cascading DropDown inside a grid "in-line" edit mode. The initial values are not being set for edit mode.  Add mode is working as expected.  I tried some jQuery  to set these manually but that did not work either.

So two problems:  

1. Why aren't the initial values set during edit mode properly?
2. Why does this code fail to change the value of the dropdown - control.value("1");

Thanks
-Jonathan





Here is the Jquery/JS I used:
<script>
    function SelectedCedingCompany() { return { CedingCompanyId: $("#CedingCompanyId").val() }; }
    function SelectedCedingCompanyLine() { return { CedingCompanyLineId: $("#CedingCompanyLineId").val() }; }
 
    function CoveredLinesAndSublinesGridBeginEdit(e)
    {
        var control = e.container.find('#CedingCompanyStateId').data('kendoDropDownList');
        control.enable();
        control.value("1");
    }
</script>


My Grid looks like this:
@(Html.Kendo().Grid<ContractScope>()
    .Name("CoveredLinesAndSublinesGrid")
    .Columns(columns =>
    {
        columns.ForeignKey(c => c.CedingCompanyId, (System.Collections.IEnumerable)ViewBag.CedingCompanies, "CedingCompanyId", "CompanyName")
            .Width(100).Title("Ceding Company")
            .EditorTemplateName("Contract/ContractScopeCedingCompanyDropDown");
         
        columns.ForeignKey(c => c.CedingCompanyStateId, (System.Collections.IEnumerable)ViewBag.CedingCompanyStates, "CedingCompanyStateId", "CedingCompanyStateDescription")
            .Width(50).Title("State")
            .EditorTemplateName("Contract/ContractScopeCedingCompanyStateDropDown");
 
        columns.Command(command => { command.Custom("Edit").SendDataKeys(true); command.Edit(); }).Width(150);
    })
    .ToolBar(tb => tb.Template(
    @<text>
    <a class='k-button k-button-icontext k-grid-add ActionButton' href="#" style="padding-top:2px; padding-bottom:4px;">
        <span class="k-icon k-add"></span>Add Covered Line / Sublines
    </a>
    </text>))
    .Scrollable(s=>s.Height(300))
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Events(events => events.Edit("CoveredLinesAndSublinesGridBeginEdit"))
    .DataSource(dataSource => dataSource
        .Ajax()       
        .Filter(filter => filter.Add(e => e.ContractId).IsEqualTo(contractID))
        .Events(events => events.Error("AjaxFailure"))
        .Model(model =>
        {
            model.Id(p => p.ContractScopeId);
            model.Field(p => p.ContractId).Editable(false);
            model.Field(p => p.ContractScopeId).Editable(false);
            model.Field(p => p.CedingCompanyId);
            model.Field(p => p.CedingCompanyStateId);
        })       
        .Read(read => read.Action("Read", "CoveredLines", new { area = "Contract" }).Type(HttpVerbs.Post))
        .Create(create => create.Action("New", "CoveredLines", new { area = "Contract", id = contractID }).Type(HttpVerbs.Post))
        .Update(update => update.Action("Update", "CoveredLines", new { area = "Contract" }).Type(HttpVerbs.Post))
        .PageSize(20)
    )   
)
My Templated  DropDown Editors:
@(Html.Kendo().DropDownList()
    .HtmlAttributes(new { id = "CedingCompanyId"})
    .DataTextField("CompanyName")
    .DataValueField("CedingCompanyId")
    .Name("CedingCompanyId")
    .DataSource(source => source
        .Read(read => read.Action("GetCedingCompanies", "CoveredLines", new { area = "Contract" })
        .Type(HttpVerbs.Post))
        .ServerFiltering(true)))

@(
    Html.Kendo().DropDownList()
    .HtmlAttributes(new { id = "CedingCompanyStateId"})
    .DataTextField("CedingCompanyStateDescription")
    .DataValueField("CedingCompanyStateId")
    .Name("CedingCompanyStateId")
    .DataSource(source => source
        .Read(read => read.Action("GetCedingCompanyStates", "CoveredLines", new { area = "Contract" })
            .Type(HttpVerbs.Post)
            .Data("SelectedCedingCompany"))
        .ServerFiltering(true))
    .Enable(true)
    .AutoBind(false)
    .CascadeFrom("CedingCompanyId")
)
Rick
Top achievements
Rank 1
 answered on 11 Sep 2014
2 answers
169 views
I'm having trouble binding a stacked bar chart to a local Model.

If I keep the data inline in the Razor file, all works fine (see attached Inline.png for the results):

<div class="chart-wrapper">
    @(Html.Kendo().Chart(Model.SeriesData)
        .Name("chart")
        .Title("Test Chart")
        .Legend(legend => legend
            .Visible(false)
        )
        .SeriesDefaults(seriesDefaults =>
            seriesDefaults.Bar().Stack(ChartStackType.Normal)
        )
        .CategoryAxis(axis => axis
            .Categories("Bob Jones", "Sarah Giant")
            .MajorGridLines(lines => lines.Visible(false))
        )
        .ValueAxis(axis => axis
            .Numeric()
            .Line(line => line.Visible(false))
            .MajorGridLines(lines => lines.Visible(true))
        )
        .Series(series =>
        {
            series.Bar(new double[] { 10, 17 }).Color("#f3ac32");
            series.Bar(new double[] { 30, 27 }).Color("#b8b8b8");
            series.Bar(new double[] { 10, 17 }).Color("#e3ac32");
            series.Bar(new double[] { 30, 27 }).Color("#ab6e36");
        })
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Template("#= series.name #: #= value #")
        )
    )
</div>

However, if I move the data to a model, it seems to bind incorrectly (See attached bound.png for the results):

@model LyncMeetingReporting.Report.Controllers.ChartModel
<div class="chart-wrapper">
    @(Html.Kendo().Chart(Model.SeriesData)
        .Name("chart")
        .Title("Test Chart")
        .Legend(legend => legend
            .Visible(false)
        )
        .SeriesDefaults(seriesDefaults =>
            seriesDefaults.Bar().Stack(ChartStackType.Normal)
        )
        .CategoryAxis(axis => axis
            .Categories(Model.Attendees)
            .MajorGridLines(lines => lines.Visible(false))
        )
        .ValueAxis(axis => axis
            .Numeric()
            .Line(line => line.Visible(false))
            .MajorGridLines(lines => lines.Visible(true))
        )
        .Series(series =>
        {
            series.Bar(m => m.Data, m => m.Colour);
        })
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Template("#= series.name #: #= value #")
        )
    )
</div>

The model:

public ActionResult Log(Guid? id, MeetingDetailsType? type)
{
    var chartModel = new ChartModel() {
        Attendees = new string[] { "Bob Jones", "Sarah Giant" },
        SeriesData = new SeriesData[]
        {
            new SeriesData() { Colour = "#f3ac32", Data = new double[] { 10, 17 }},
            new SeriesData() { Colour = "#b8b8b8", Data = new double[] { 30, 27 }},
            new SeriesData() { Colour = "#e3ac32", Data = new double[] { 10, 17 }},
            new SeriesData() { Colour = "#a8b8b8", Data = new double[] { 30, 17 }},
        }
    };
 
    return View(chartModel);
}
 
public class ChartModel
{
    public IEnumerable<string> Attendees { get; set; }
    public IEnumerable<SeriesData> SeriesData { get; set; }
}
 
public class SeriesData
{
    public double[] Data {get; set;}
    public string Colour {get; set; }
}

Paul Nearney
Top achievements
Rank 1
 answered on 11 Sep 2014
3 answers
137 views
please see the print of my browser. I could not download de offline version of mvc trial.
Yana
Telerik team
 answered on 11 Sep 2014
1 answer
280 views
Hi all,

I have a discount % field that's a nullable int, and uses an up/down editor.  Users want to show "None" in the field when the value is null, and want to be able to select "None" in addition to values 0 - 100 when editing the field.  Is there a feature in place to display a default value for null?

As it stands, it shows empty in the grid, and you can clear the text in the editor to revert back to null.  It works functionally, but may not satisfy the request.

If the feature doesn't currently exist, what would be the best way to go about enhancing the up/down control to enable it?

Thanks!
Alexander Popov
Telerik team
 answered on 11 Sep 2014
2 answers
279 views
Hi,

When running the Create, Read, Update, Destroy events. I want to pass in the value of  $("MasterAccountID") to the controller. I can't figure out how to do with, without writing the JavaScript manually.

<input type="textbox" name="MasterAccountID"  id="MasterAccountID" />
@(Html.Kendo().Grid<Ownership>() // Specify the type of the grid
                .Name("Ownership")
                .Columns(columns =>
                {
                    columns.Bound(o => o.AccountName);
                    columns.Bound(o => o.AccountNumber);
                    columns.Bound(o => o.Percent);
                    columns.Bound(o => o.Status);
                    columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                })
 
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .ServerOperation(true)
                    .PageSize(20)
                    .Model(model =>
                    {
                        model.Id(o => o.AccountNumber);
                    })
 
                    .Read(read => read.Action("Ownership_Read", "Owner", [PASS TEXTBOX VALUE]))
                )
        )
Dimiter Madjarov
Telerik team
 answered on 11 Sep 2014
1 answer
124 views
We use the Grid View and the associated popup editor templates to good effect.

However, there are a number of situations where we need to be able to view or edit a specific item on the Grid but without necessarily going via the Grid.

e.g. You have a:
Grid with associated Editor Windows for Events, Actions and other items
A list of Notifications which includes links to any of these, and shown via a UL list

Each one needs to link to the specific Action, Event etc, not to a grid of multiple Actions, Events etc. Ideally, we're looking for a View that will support editing and viewing, both directly from a Grid and not from a Grid.

Has anyone had experience of doing this and any recommendations for achieving it.

Thanks,

Chris.
Dimo
Telerik team
 answered on 11 Sep 2014
2 answers
213 views
Hi,

I'm looking for a way to detect that a user has keyed in an invalid date into a date time picker control where having a blank/nullable date IS valid.  Currently, I cannot tell the difference (looking at a model object) if a user cleared the date or typed the word "dog" into the text box rather than a valid date format because both appear as null.  I've tried using the element's change event, but it doesn't fire if the initial value is null (blank), which makes since if it evaluates "dog" as a null (there would be no change for its initial value of null).  

I thought perhaps a validator was the correct way of handling this.  When I change an item in my observable array the change event is fired by the array, I then called myValidator.validate() method, but it always returns true.  Also, the validator itself runs AFTER the observable array's change method. Since myValidator.validate() returned true, I save the data to the server.  Once the validator does fire, it validates the date field and thinks it is invalid.  This leaves me with a word like "dog" sitting in my date time picker and a null getting sent to the server.

How can I tell my user that "dog" isn't a proper date and prevent it from going to the server?

Dave
Dave
Top achievements
Rank 1
 answered on 10 Sep 2014
2 answers
377 views
I picked the Row filtering mode because my users want to be able to see the filters all the time, but there's a bit of a problem.

The second the user starts typing something into a filter, the page starts to refresh itself. If a user were typing "SalesOrder," by the time the page loads, only the 's' would show in the filter. I do not want this behavior. I want the user to be able to finish typing, then either tab out of the filter they were typing in or click somewhere else or click one of the filter options like "Contains" or "Starts With" AND THEN the page can load.

Is there something I'm missing in the code to do that? I can get a lot of records by filtering, and I can't afford for the page to load every time a user types in one character.

Please help! :(

​    @(Html.Kendo().Grid(Model)
        .Name("TransactionGrid")
        .DataSource(dataSource => dataSource
            .Server()
            .Model(model => model.Id(o => o.TransactionID))
            .PageSize(1000)
        )
        .Columns(columns =>
        {
            columns.Bound(r => r.TransactionID).Title("ID").Hidden();
            columns.Bound(r => r.MessageType);
            columns.Bound(r => r.SourceSystem.Name);
        })
        .HtmlAttributes(new { style = "width:100%;" })
        .Resizable(resizing => resizing.Columns(true))
        .Pageable()
        .Groupable()
        .Filterable(filtering => filtering.Mode(GridFilterMode.Row))
        .Sortable(sorting => sorting.Enabled(true))
        .Selectable(selecting => selecting.Enabled(true))
        .Scrollable(s => s.Height(600))
    )
Ray
Top achievements
Rank 1
 answered on 10 Sep 2014
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
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
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?