Telerik Forums
UI for ASP.NET MVC Forum
3 answers
161 views
Hi,

I am trying to call a Html extension helper method  'GetUserFormattedId' from the client template of  a ajax bound grid column. I am trying the format a value of the column.

I am unable to get it working. Is it allowed to call extension methods in this way? Please advise. 

@{
          Html.Kendo().Grid<InvoiceSummaryDto>()
          .Name("invoiceAccountingGrid")
          .Columns(columns =>
          {
              columns.Bound(l => l.Id).ClientTemplate("<a href='" + @Url.Action("Details", "Invoice", new { area = "Accounting" }) + "/#= Id #'" + ">" + @Html.GetUserFormattedId(@"#= Id #") + "</a>").Title("ID");
              columns.Bound(l => l.ItemsDescription).Title("Description");
                    
          })

I
Dimiter Madjarov
Telerik team
 answered on 15 Sep 2014
3 answers
533 views
Hello, I need to check if the Window is already init, if possible. 

Do you know if there is a good way to know this ? Without use a parameter in my controller would be best.

Thanks
Dimiter Madjarov
Telerik team
 answered on 15 Sep 2014
5 answers
564 views
I would like to use inline editing with KendoUI grids in an MVC context, but can't at the moment for any data containing Date fields, because whenever I click the Update button (whether after creating a new record, or editing an existing one), even if I haven't changed the date field, I get a validation error (e.g. if the field is DateOfBirth)

"The field Date of Birth must be a date". (please see attached screenshot)

The date format I am setting for the Grid is dd MMM yyyy (because this is unambigous, whereas e.g 04 06 2012 is ambiguous and could mean either 4 June 2012 or 6 April 2012) and my pc (Windows 8, running Visual Studio 2012) is set up with UK regional settings.

(I have a support ticket set up for this, but no solution yet after 10 days), so am posting it here in case anyone else can help.

NB It has been suggested that I set the culture to "en-GB" (which I have never had to do before, including lots of other [non inline editing] use of KendoUI grids), but it didn't resolve the problem.

Thanks in advance for your help
Patrick
Top achievements
Rank 2
 answered on 12 Sep 2014
9 answers
199 views
How can I add a Color Picker to the event dialog using resources?  I even looked at a custom editor but recreating the stock event dialog seems like it will be complex just to add a Color Picker.

Is there a demo for this?

.Resources(resource =>
    {
        resource.Add(m => m.Color)     // Need this to be a color picker
            .Title("Color")
            .DataTextField("Name")
            .DataValueField("ColorID")
Petur Subev
Telerik team
 answered on 12 Sep 2014
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
111 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
754 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
164 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
133 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
274 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
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
MediaPlayer
TileLayout
DateInput
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?