Telerik Forums
UI for ASP.NET MVC Forum
1 answer
265 views
Controller Method:

        public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
        {
            if (invoices != "fail")
            {

            List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);

            return Json(customer.ToDataSourceResult(request));
            }
            else
            {
                //do nothing
            }
        }

I am trying to upgrade the grid using ajax
        $.ajax({
            url: webManager.resolveUrl("~/maint/GetCustomerComments"),
            method: "POST",
            data: { invoices: invoicesList },
            success: function () {
                var grid = $('#CustomerCommentsGrid').data('kendoGrid');
                grid.dataSource.read();
                grid.refresh();
            },
            error: function () {
                alert('an error occurred');
            }

        });

But the problem is Grid is called again and I want to stop that.

     @(Html.Kendo().Grid<CustomerComments>()
      .Name("CustomerCommentsGrid")
      .Columns(columns =>
      {
          columns.Bound(i => i.INVOICE).Title("Invoice").Width(15);
          columns.Bound(i => i.Comment).Title("Comment").Width(40);

      }).Pageable(pageable => pageable
          .Refresh(true)
      )
      .Scrollable()
      .Sortable()
      .Filterable()
      .DataSource(dataSource => dataSource
          .Ajax().UseJniErrorHandler()
          .PageSize(10)
              .Read(read => read.Action("GetCustomerComments", "Maint", new { invoices = "fail" }))
      )
)
Gaurav
Top achievements
Rank 1
 answered on 23 Jun 2016
1 answer
87 views

Does Telerik have the ability to generate a IMB(OneCode) bar code?

 

I ask since I saw an option for the POSTNET barcode which was retired from the USPS in 2013.

 

Please advise.

Viktor Tachev
Telerik team
 answered on 23 Jun 2016
1 answer
98 views
Hi ,
We are unable to resize grid columns in IE 11 with latest version v2016.2.607 but it was working in its previous version v2016.1.226. Kindly help in this regard ASAP.

Warm Regards,
Vibhor
Orlin
Telerik team
 answered on 23 Jun 2016
1 answer
152 views

I have a custom popup editor that's used as the editor in a parent grid and in the nested grid of another parent grid:

Grid 1 -> Shared Custom Popup
Grid 2 >Tabstrip > Nested Grid -> Shared Custom Popup

In the popup editor, I have a field "created_date" that I need to display as a string instead of an editor box. I know that for popup editors of a parent grid, I  need to use this syntax:

${kendo.toString(created_date, "MM/dd/yyyy hh:mm tt")}

And for popup editors of a nested grid, I need to use this syntax:

#= kendo.toString((created_date), "MM/dd/yyyy hh:mm tt") #

The syntax for popup editors of a parent grid won't work for the popup editors of a nested grid and vice versa.

How would I display a string for a field in a popup editor that's shared between a parent grid and the nested grid of another parent grid?

Danail Vasilev
Telerik team
 answered on 22 Jun 2016
1 answer
149 views

I have a simple Kendo UI grid setup for serverside processing which displays some employee information.  The grid displays just fine when i first load the view but as soon as you click on a column to sort it refreshes and just gives me an empty grid.  The Action is firing each time a column header is click and is returning the correct amount of records to the view.  See my code below:

View:

@ModelType List(Of ConnectEntities.Employee)
 
@Code
    ViewData("Title") = "CompanyDirectory"
    Layout = "~/Views/Shared/_HomeLayout.vbhtml"
 
End Code
 
 
    <div class="row">
 
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4>Company Directory</h4>
 
                </div>
                <div class="panel-body">
                    @Code
                        Html.Kendo.Grid(Of ConnectEntities.Employee)() _
                                                    .Name("employeeDirectory") _
                                                    .BindTo(DirectCast(ViewData("employees"), IEnumerable(Of ConnectEntities.Employee))) _
                                    .Columns(Sub(c)
                                                 c.Bound(Function(p) p.FirstName_AD).Sortable(True)
                                                 c.Bound(Function(p) p.LastName_AD)
                                                 c.Bound(Function(p) p.JobTitle_AD)
                                                 c.Bound(Function(p) p.PhoneNumber_AD)
 
                                             End Sub) _
                                                                                     .DataSource(Sub(d)
                                                                                                     d.Server() _
                                                                                                     .Read(Function(read) read.Action("Person_Read", "Home"))
 
                                                                                                 End Sub) _
                                                                                     .Sortable() _
                                                                                     .Filterable() _
                        .Render()
 
 
 
                    End Code
 
 
                </div>
            </div>
        </div>
    </div>

 

Controller Code:

Function CompanyDirectory() As ActionResult
 
    Dim employees As List(Of ConnectEntities.Employee)
 
    Using connectDB As New ConnectEntities.ConnectEntities
        employees = connectDB.Employees.ToList
    End Using
 
    ViewData("employees") = employees
 
    Return View()
 
 
End Function

 

Public Function Person_Read() As ActionResult
 
 
    Dim employees As List(Of ConnectEntities.Employee)
 
    Using connectDB As New ConnectEntities.ConnectEntities
        employees = connectDB.Employees.ToList
    End Using
 
    Return View("CompanyDirectory", employees)
 
 
End Function

 

 

Pavlina
Telerik team
 answered on 21 Jun 2016
4 answers
117 views

Hi,

 

The grid column headers split the view model property names when there is an uppercase character in the viemodel property name. That is good. But when I have an non-English character in the name the column header will also be split. Is this the intended behaviour? I know I can workaround the issue by using DisplayName in the model or .Title() in the grid, but that is a lot of unnecessary work.

ViewModel:

    public class AvslagnaIndexViewModel
    {
        public Guid Id { get; set; }
        public string DiarieNummerSSM { get; set; }
        public DateTime AnsökningsDatum { get; set; }
        public string Handläggare { get; set; }
        public string ExportörNamn { get; set; }
        public string SlutanvändareNamn { get; set; }
        public string BestämmelseLandNamn { get; set; }
        public string Status { get; set; }
    }

Grid columns:
        .Columns(columns =>
        {
            columns.Bound(p => p.Id).Hidden().Title("Id");
            columns.Bound(p => p.DiarieNummerSSM).ClientTemplate(
                Html.ActionLink("#=DiarieNummerSSM#", "Details", "Avslagna", new { id = "#=Id#" }, new { title = "Visa ärendedetaljer", @class = "k-link k-grid-edit-row" }).ToHtmlString()).Width(120);
            columns.Bound(p => p.AnsökningsDatum).Format("{0:yyyy-MM-dd}");
            columns.Bound(p => p.Handläggare);
            columns.Bound(p => p.ExportörNamn);
            columns.Bound(p => p.SlutanvändareNamn);
            columns.Bound(p => p.BestämmelseLandNamn);
            columns.Bound(p => p.Status);
        })

See the attached image for the result. All words containing non-English caracters are split in more places than they should be. As you can see "BestämmelseLandNamn" is shown as "Bestä mmelse Land Namn"

Best regards,

Henrik

Henrik
Top achievements
Rank 1
 answered on 21 Jun 2016
2 answers
197 views

I am trying to open a kendo window based on input from a form. I am getting this error:

JavaScript runtime error: Object doesn't support property or method 'open'

The error occurs when win.open(); is called in the JavaScript in the view as listed below. Any help would be great.

Here is my controller:

using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
using KendoGridAjaxBinding.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace KendoGridAjaxBinding.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            TheModel m = new TheModel();
 
            return View(m);
        }
 
        public ActionResult Search( TheModel m)
        {
            if (m.Name != string.Empty)
            {
                ViewData["OpenGrid"] = "OpenGrid";
            }
            return View("Index", m);
        }
 
    }
}

Here is my view:

@using System
@using System.Web
@using System.Web.Mvc
@using System.Web.Razor
@using Kendo.Mvc.UI
@using KendoGridAjaxBinding.Models
 
@model TheModel
 
@using (Html.BeginForm("Search", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    <label for="textinput">Name</label>@Html.TextBoxFor(model => model.Name, new { @class = "input-xs form-control", placeholder = "Name", type = "text" })<br />
    <label for="textinput">Address</label>@Html.TextBoxFor(model => model.Address, new { @class = "input-xs form-control", placeholder = "Address", type = "text" })<br />
    <label for="textinput">City</label>@Html.TextBoxFor(model => model.City, new { @class = "input-xs form-control", placeholder = "City", type = "text" })<br />
    <label for="textinput">State</label>@Html.TextBoxFor(model => model.State, new { @class = "input-xs form-control", placeholder = "State", type = "text" })<br />
    <button id="Search" class="btn btn-primary">Search</button>
}
 
 
 
@(Html.Kendo().Window()
    .Name("window")
    .Width(630)
    .Height(315)
    .Draggable()
    .Resizable()
    .Title("Test Test Test")
    .Actions(actions => actions.Pin().Refresh().Maximize().Close())
    .Visible(false)
)
 
<script type="text/javascript">
    var messageX = '@ViewData["OpenGrid"]';
    if (messageX = "OpenGrid")
    {
        $("#window").kendoWindow();
        var win = $("#window").data("kendoWindow");
 
        var win = $("#window")
        if (win != null)
        {
            win.open();
        }
    }
 
</script>

The Model:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace KendoGridAjaxBinding.Models
{
    public class TheModel
    {
        public string Name { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string State { get; set; }
    }
}

Thanks in advance,

rstinson

Randy
Top achievements
Rank 1
 answered on 21 Jun 2016
33 answers
786 views

When do you have a working release?

The nuget package 2016.2.607 does not install.

When do we have a version for payed customer without demo message.

When will the documentation for RC2 be updated?

I know it is a RC but as you advertise and blog about it as if it works I am a little suprised that the quality is so bad.

Jan Olsmar
Top achievements
Rank 1
 answered on 21 Jun 2016
2 answers
156 views

I have a grid bound to a ViewModel, and the 3rd column is bound to an empty property.  This data did not come from a database,so there is no foreign key relationship, in fact there's no database involved at all.  In the 3rd column I would like a drop down.  This would be the same dropdown in each row of the grid. That dropdown should contain a list of properties (List<string>).  When a value is selected,that specific item should be removed from the dropdown list on subsequent rows.

So how can I go about building such a beast?  It's easy enough to do in a WebForm, but alas using MVC and these Kendo components has left a real bad taste in my mouth.  It seems as if everything has to be gotten via an AJAX call, or must call into some action, or must be bound somewhere along the line; and nothing seems to work out of the box.

I'm using this to map a CSV file to an object.  So using the file uploader action, I parse the column headers out of the CSV file, and create a List<CVSColumn> that is actually a property of my CSVColumnsViewModel:

namespace FileUploader_Mapper.Models
{
    public class CSVColumn
    {
        public int ColumnNumber { get; set; }
        public string ColumnName { get; set; }
        public string MappedTo { get; set; }
    }
 
    public class CSVColumnsViewModel
    {
        public string CSVFile { get; set; }
        public List<CSVColumn> Columns = new List<CSVColumn>();
        public List<string> Properties { get; set; }
 
        public CSVColumnsViewModel()
        {
            Properties = new List<string>
            {
                "FirstName",
                "LastName",
                "SSN",
                "Address1",
                "Address2",
                "City",
                "State",
                "Zip"
            };
        }
    }
}

 

In the first column of the grid is the ColumnNumber property, the second column is the ColumnName property, and the 3rd column is empty, but is mapped to the MappedTo property.  What I want to do is show the list of Properties in a dropdown in the third column so the user can choose which property the current column would map to.  Then in the next row, it would only show available properties for the additional columns to map to.

I hope this is making sense...

Here's what I have in my cshtml file

@using FileUploader_Mapper.Models
@model CSVColumnsViewModel
 
@{
    ViewBag.Title = "Result";
}
 
<style>
    .k-grid td {
        line-height: 2em;
        padding: 0 0 0 1em;
    }
</style>
 
<h2>Result</h2>
 
<p></p>
 
@(Html.Label("lblMisc", "Columns from CSV File: " + Model.CSVFile))<br/>
 
@(Html.Kendo().Grid(Model.Columns)
    .Name("csvGrid")
    .HtmlAttributes(new { style = "width: 650px" })
    .Columns(col =>
    {
        col.Bound(c => c.ColumnNumber).Width(125).Title("Column Number");
        col.Bound(c => c.ColumnName).Title("Column Name");
        col.Bound(c => c.MappedTo).Title("Mapped To");
    })
    .DataSource(ds => ds
        .Ajax()
        .PageSize(20)
        .ServerOperation(false)
        .Model(m =>
        {
            m.Id(c => c.ColumnNumber);
            m.Field(c => c.ColumnName).Editable(false);
            m.Field(c => c.MappedTo).DefaultValue(Model.Properties);
 
        })
    )
    .Pageable()
)

I really don't know how to proceed and could use some guidance.

Maria Ilieva
Telerik team
 answered on 21 Jun 2016
1 answer
320 views

Hello,

 

I'm trying to implement a kendo grid with server side sorting and filtering. I want to be able to sort using the DataSourceRequest.Sort object by more than just the member type and sort direction.

 

I essentially want the equivalent of the following IEnumerable OrderBy Method

 

queryList.OrderBy(x => x.SomeMember == SomeConstantValue)

 

Is there a way to do this by using the SortDescriptor Object?

 

Any help would be appreciated

Danail Vasilev
Telerik team
 answered on 21 Jun 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
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?