Telerik Forums
UI for ASP.NET MVC Forum
2 answers
58 views

Hi,

After I updated from 2015.3.1111 trial to 2016.2.714 (licensed) my grid incell edit is not longer working.I can select the row with the checkbox, uncheck it, but as soon as I leave the cell, it is again checked. I assume that the change is not being applied to the underlying model (and I see "Ja" in the cell) ...

Here is my grid:

@(Html.Kendo().Grid<ModelLayer.Bild>()
    .Name("bildergrid")
    .HtmlAttributes(new { style = "height:600px;" })
    .Columns(columns =>
    {
        columns.Bound(p => p.BildBase64).Title("").ClientTemplate("<img class='gallery' rel='bilder' style='width:100px' href='data:image/png;base64, #: BildBase64#' src='data:image/png;base64, #: BildBase64#'>").HtmlAttributes(new { style = "max-width:100px;width:100px;" }).Width(100);       
        columns.Bound(p => p.Internet).Width(30).ClientTemplate("#= Internet ? 'Ja' : 'Nein' #");
        columns.Bound(p => p.Expose).Width(30).Title("Mail").ClientTemplate("#= Expose ? 'Ja' : 'Nein' #");
        columns.Bound(p => p.Drucken).Width(30).ClientTemplate("#= Drucken ? 'Ja' : 'Nein' #");
        columns.Bound(p => p.Dateiname).Width(200);
        columns.Bound(p => p.Groesse).Width(80).Visible(false); ;
        columns.Bound(p => p.Pixel).Width(80).Visible(false);
        columns.Bound(p => p.Position).Width(100);
        columns.Bound(p => p.Pfad).Visible(false);
    })
        .DataSource(dataSource => dataSource

            .Ajax()
            .PageSize(0)
            .Read(r => r.Action("Bilder_Read", "Immo", new { immobilieId = "728" }))
            .ServerOperation(false).Model(model => model.Id(p => p.Id))
         )
         .Editable(e => e.Mode(GridEditMode.InLine))
        .Resizable(i => i.Columns(true))
        .Selectable(e => e.Enabled(true).Mode(GridSelectionMode.Single))
        .Scrollable()
        .AutoBind(false)
        //.ToolBar(t=> t.Create())


)

Konstantin Dikov
Telerik team
 answered on 26 Jul 2016
4 answers
306 views

I'm having a problem with a hierarchical grid: when I run my solution, the date doesn't show in the correct format, and because of that I can't see the child grid. But when I deploy the application, it does show correctly but it has an error, and I can't debug to solve it.

Here is the grid:

@(Html.Kendo().Grid(Model)
        .Name("OperacionesOCTVigentes")
        .DataSource(dataSource => dataSource
        .Ajax()
            .Read(read => read.Action("OperacionesOCTVigentes_Read", "Operaciones")
            .Data("ParametrosOCTVigentes"))
        .PageSize(30)
        .Aggregates(a =>
            {
                a.Add(p => p.Compras).Sum();
                a.Add(p => p.Ventas).Sum();
                a.Add(p => p.Neto).Sum();
                a.Add(p => p.MTM).Sum();
            })
        )
        .Columns(columns =>
        {
            columns.Bound(foo => foo.fecha_venc).Title(Global.Fecha).Format("{0:dd/MM/yyyy}").HtmlAttributes(new { @class = "grillaFecha" });
            columns.Bound(foo => foo.espe_codigo).Title(Global.Especie).HtmlAttributes(new { @class = "grillaTexto" });
            columns.Bound(foo => foo.clas_codigo).Title(Global.Clase).HtmlAttributes(new { @class = "grillaTexto" });
            columns.Bound(foo => foo.Compras).Title(Global.Compras).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
            columns.Bound(foo => foo.Ventas).Title(Global.Ventas).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
            columns.Bound(foo => foo.Neto).Title(Global.Neto).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
            columns.Bound(foo => foo.MTM).Title(Global.Capital).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
        })
        .ClientDetailTemplateId("template")
    )

And this is the child grid:

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<SGMTrade.DAL.ViewModels.OperacionesOCTPorFecha>()
                .Name("grid2_#=row#")// "grid2_#=fecha_venc#
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(10)
            .Read(read => read.Action("OperacionesOCTPorFecha_Read", "Operaciones", new { fecha = "#=fecha_venc#", especie = "#=espe_codigo#", cliente = @ViewBag.cliente, clase = "#=clas_codigo#" }))
        )
        .Columns(columns =>
        {
            columns.Bound(o => o.oper_numero).Title(Global.NumeroOperacion)
                .ClientTemplate("<a href='\\\\\\#' onclick=\"showDetails('\\#=oper_numero\\#')\">\\#=oper_numero\\#</a>").HtmlAttributes(new { @class = "grillaNumero" });
            columns.Bound(o => o.oper_forigen).Title(Global.FechaOrigen).Format("{0:dd/MM/yyyy}").HtmlAttributes(new { @class = "grillaFecha" });
            columns.Bound(o => o.espe_codigo).Title(Global.Especie).HtmlAttributes(new { @class = "grillaTexto" });
            columns.Bound(o => o.clas_codigo).Title(Global.Clase).HtmlAttributes(new { @class = "grillaTexto" });
            columns.Bound(o => o.clie_nombre).Title(Global.Cliente).HtmlAttributes(new { @class = "grillaTexto" });
            columns.Bound(o => o.tope_suma).Title(Global.CompraOVenta).HtmlAttributes(new { @class = "grillaTexto" });
            columns.Bound(o => o.oper_monto).Title(Global.Capital).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" });
            columns.Bound(o => o.oper_plazo).Title(Global.Plazo).HtmlAttributes(new { @class = "grillaNumero" });
            columns.Bound(o => o.Fecha_Vence).Title(Global.FechaVence).Format("{0:dd/MM/yyyy}").Hidden(true).HtmlAttributes(new { @class = "grillaFecha" });
            columns.Bound(o => o.precio_transf).Title(Global.PrecioTransferencia).HtmlAttributes(new { @class = "grillaNumero" });
            columns.Bound(o => o.spread).Title(Global.Spread).HtmlAttributes(new { @class = "grillaNumero" });
        })
        .Pageable()
        .Sortable()
        .Selectable()
        .Scrollable(s => s.Height(100))
        .Resizable(resize => resize.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
        .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
        .ToClientTemplate()
    )

</script>

 

In the first attached file it can be seen how the parent grid displays, and in the second one it can be seen that since the date format is incorrect, it can't perform the desired action (show details from database).

 

What can I do? Thanks in advance

Danail Vasilev
Telerik team
 answered on 26 Jul 2016
1 answer
68 views

Hi everyone,

 

In a page I have several charts/grids that takes a while to load (because the data are manipulated before the rendering), so there is no issue with the Telerik component here.
My issue is: I'm on the page and the charts/grids are loading, if I click on a link that redirect to an other page of my application and if the charts/grids are still loading I'm not directly redirect to the other page. I think that the page is waiting for the charts/grids to be 100% rendered before redirecting me to the other page. So, sometimes, I need to wait for about 10-15 seconds (because of the manipulation of data server side) to be redirected to the other page.

Is there any solution to stop the rendering of the charts/grids when I click on a link ?

 

Thank you in advance for your response.

Dimo
Telerik team
 answered on 25 Jul 2016
3 answers
135 views

Is there any way to toggle tooltips for different tasks in the Gantt based on a field set in the model? We have some tasks that require tooltips, and I made a template for them that displays some model fields. When a top-level (i.e., summary) task does not contain children, I've added a task that displays No Tasks as its title (per user requirements). It is for these 'No Tasks' tasks that I would like to completely toggle off tooltips. Any suggestions?

Bozhidar
Telerik team
 answered on 25 Jul 2016
1 answer
114 views

So I've got a grid that I believe is all set up correctly. I've confirmed that the data is coming through, and I've even checked that the AJAX call returns a success with the "ToDataSourceResult" JSON data.

 

Unfortunately, the only problem is that the data doesn't display. This seems to only be an issue on read, as update, create and delete all work. Just can't retrieve the list of all items afterwards.

 

My controller action looks like this: 

public IActionResult Blog_Read([DataSourceRequest] DataSourceRequest request)
        {
            var blogs = _blogService.GetPosts().Select(post => new BlogPostModel
            {
                Id = post.Id,
                Title = post.Title,
                Author = post.Author,
                ShortDescription = post.ShortDescription,
                Contents = post.Contents,
                LastSaved = post.LastSaved,
                Published = post.Published,
                PublishedOn = post.PublishedOn
            });
            var result = blogs.ToDataSourceResult(request);
            return Json(result);
        }

 

And my Grid View looks like this:

@(Html.Kendo().Grid<BlogPostModel>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(p => p.Title);
                columns.Bound(p => p.Author).Width(120);
                columns.Bound(p => p.LastSaved).Width(120);
                columns.Bound(p => p.Published).Width(120);
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
            })
            .ToolBar(toolbar => toolbar.Create())
            .Editable(editable => editable.Mode(GridEditMode.PopUp))
            .Pageable()
            .Sortable()
            .Scrollable()
            .HtmlAttributes(new { style= "height:600px;"})
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(20)
                .Events(events => events.Error("error_handler"))
                .Model(model => model.Id(p => p.Id))
                .Create(update => update.Action("Blog_Create", "BlogAdmin"))
                .Read(read => read.Action("Blog_Read", "BlogAdmin"))
                .Update(update => update.Action("Blog_Update", "BlogAdmin"))
                .Destroy(update => update.Action("Blog_Delete", "BlogAdmin"))
            )
            .Deferred()
        ) 

 

The correct JSON is returned, no javascript errors in the console, so I'm a little confused as to what this could be. Any help would be greatly appreciated.

 

Adam
Top achievements
Rank 1
 answered on 24 Jul 2016
1 answer
505 views

The View is rendered empty as if there is an exception when Editor is generated.
The DropDownList is not populated in the Editor.
If the Bind is commented in the Editor, the view is rendered and the Editor display the dropdownlist of course with no content.
So The problem comes from the Bind.
Any Help will be appreciated

My Model
  public partial class TA_SITE_SIT
    {
    public TA_SITE_SIT()
      {
      TA_BUILDING_BUI = new HashSet<TA_BUILDING_BUI>();
      }
    [Key]
     public Guid GUID_SIT { get; set; }
    public string NAME_SIT { get; set; }
    [InverseProperty("GUID_SITNavigation")]
    public virtual ICollection<TA_BUILDING_BUI> TA_BUILDING_BUI { get; set; }
    }
  public partial class TA_BUILDING_BUI
    {
    [Key]
    public Guid GUID_BUI { get; set; }
    public Guid? GUID_SIT { get; set; }
    public string NAME_BUI { get; set; }
    [ForeignKey("GUID_SIT")]
    [InverseProperty("TA_BUILDING_BUI")]
    public virtual TA_SITE_SIT GUID_SITNavigation { get; set; }
    }

My Controller
    public async Task<IActionResult> Index()
      {
      ViewData["arSites"] = new SelectList(_context.TA_SITE_SIT, "GUID_SIT", "NAME_SIT");
      return View(await _context.TA_BUILDING_BUI.ToListAsync());
      }

My View
@(Html.Kendo().Grid<TA_BUILDING_BUI>(Model)
    .Name("Buildings")
    .Columns(columns =>
    {
        columns.Bound(model => model.NAME_BUI);
        columns.Command(command =>
        {
            command.Edit();
        });
    })
    .Editable(editable =>
    {
        editable.Mode(GridEditMode.PopUp);
        editable.TemplateName("BuildingEditor");
    })
    .DataSource(dataSource => dataSource
    .Ajax()
    .Model(model => model.Id(m => m.GUID_BUI))
    .Update(update => update.Action("Update", "Building"))
    .Destroy(destroy => destroy.Action("Destroy", "Building"))
    )
)
My Editor Template
@model TelAcces3.Models.TA_BUILDING_BUI
@(Html.Kendo().DropDownList()
          .Name("DropDownList")
          .DataTextField("NAME_SIT")
          .DataValueField("GUID_SIT")
          .BindTo(ViewBag.arSites)
)


Viktor Tachev
Telerik team
 answered on 22 Jul 2016
7 answers
495 views
I've been fidleing around and can't seem to find exemple of how to customize Marker Shape base on Data Type with Remote Data.

I does work fine with Hard Coded Markers but it seems like we Only can Bind Location and Title with Remote Data.

Is there Any way to do this or will I have to do this the dirty way, with a foreach loop with the model collection n razor view?
Jonathan
Top achievements
Rank 1
 answered on 22 Jul 2016
2 answers
2.1K+ views

Hello, 

I have a problem  with validation message for DatePicker in UI for ASP.NET MVC. 

Property in model:

[DataType(DataType.Date, ErrorMessage = "Please enter a valid date. - TEST")]
public DateTime FromDateTime { get; set; }

Part of my cshtml file:

@(Html.Kendo().DatePickerFor(model => model.Filter.FromDateTime)
.Name("Filter.FromDateTime")
.Format(DateTimeFormats.DateTimeFormat)
.ParseFormats(DateTimeFormats.ParseFormat)                         
.HtmlAttributes(new {@class = "form-control", style = "width: 100%"})
)
@Html.ValidationMessageFor(model => model.Filter.FromDateTime, "", new { @class = "text-danger" })

This is part of the html page which is generated from the cshtml file:

<input name="Filter.FromDateTime" class="form-control k-input input-validation-error" id="Filter_FromDateTime" role="combobox" aria-disabled="false" aria-expanded="false" aria-invalid="true" aria-required="true" aria-describedby="Filter_FromDateTime-error" aria-owns="Filter_FromDateTime_dateview" style="width: 100%;" type="text" value="20. 4. 2016" data-val-required="Toto datum musí být vyplněno." data-val-date="The field FromDateTime must be a date." data-val="true" data-role="datepicker">

Image of the part of the html page from webbrowser is in file "datepickerError.png".

The problem is in the content of the validation message. Message in my model is "Please enter a valid date. - TEST" but message in html is "The field FromDateTime must be a date." 

I want to create localization of this message and change its content. How can I do it?

Thank you for your advice.

 

 

 

 

 

Jiri
Top achievements
Rank 1
 answered on 22 Jul 2016
4 answers
198 views

Hello.

I have the following DataTable (dataTable.JPG attached file), I want to generate a chart that looks similar to the attached file (Chart.png)

It has up to 3 levels of grouping as you can see in the chart, how can I accomplish this in charts for ASP.NET MVC?

Thank you.

 

 

Misho
Telerik team
 answered on 22 Jul 2016
1 answer
133 views

Hi,

I'm having a problem with the aggregates on my server-bound grid. Here's my code:

@(Html.Kendo().Grid(Model[j].BusinessUnitTimesheets)
    .Name("BU_Time" + j)
        .DataSource(d => d
            .Server()
            .Aggregates(ag =>
            {
                ag.Add(a => a.Amount).Sum();
                ag.Add(a => a.Hours).Sum();
            })
        )
    .Columns(columns =>
    {
        columns.Bound(c => c.BusinessUnitId)
            .Hidden();
        columns.Bound(c => c.BusinessUnitCodeAndName)
            .Title("Business Unit")
            .ClientFooterTemplate("Total");
        columns.Bound(c => c.Hours)
            .Format("{0:N2}")
            .HtmlAttributes(new { style = "text-align:right;" })
            .ClientFooterTemplate("#=sum#")
            .FooterHtmlAttributes(new { style = "text-align:right;" });
        columns.Bound(c => c.Amount)
            .Width(100).Format("{0:N2}")
            .HtmlAttributes(new { style = "text-align:right;" })
            .ClientFooterTemplate("#=kendo.toString(sum,'N2')#")
            .FooterHtmlAttributes(new { style = "text-align:right;" });
    })
    .DetailTemplate(
        @<text>
        @(Html.Kendo().Grid(item.UserTime)
            .Name(string.Format("BU_U_Time{0}_{1}", j, item.BusinessUnitId))
            .DataSource(d => d
                .Server()
                .Aggregates(ag =>
                {
                    ag.Add(a => a.Hours).Sum();
                    ag.Add(a => a.Amount).Sum();
                })
            )
            .Events(e => e.DataBinding("splitBound"))
            .Columns(columns =>
            {
                columns.Bound(c => c.UserName)
                    .Title("User");
                columns.Bound(c => c.Hours)
                    .Format("{0:N2}")
                    .HtmlAttributes(new { style = "text-align:right;" })
                    .ClientFooterTemplate("#=sum#")
                    .FooterHtmlAttributes(new { style = "text-align:right;" });
                columns.Bound(c => c.Amount)
                    .Width(100)
                    .Format("{0:N2}")
                    .HtmlAttributes(new { style = "text-align:right;" })
                    .ClientFooterTemplate("#=kendo.toString(sum,'N2')#")
                    .FooterHtmlAttributes(new { style = "text-align:right;" });
            })
        )
        </text>
    )
)

 

I've attached a screenshot of the rendered grid. The totals are in the wrong columns for the parent grid, and both parent and child have sums that are zero.

 

Thanks

Pavlina
Telerik team
 answered on 21 Jul 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
DateTimePicker
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
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?