Telerik Forums
UI for ASP.NET MVC Forum
1 answer
60 views
How to apply telerik tool on 1 lakh records.
Alexander Popov
Telerik team
 answered on 26 May 2014
2 answers
153 views
Hi,

Something went wrong with my Kendo UI Grid.

Miss something in css?


Toan
Top achievements
Rank 1
 answered on 26 May 2014
1 answer
112 views
we have an EditorTemplate which is:
1.<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<int?>" %>
2.<%= this.Html.Kendo().DropDownList().DataSource(ds => ds.Read(read => read.Action("GetListPort","AjaxCombo")))
3..Name(this.ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
4..HtmlAttributes(new { style = "width:99%;" })
5.%>

this is kind of a cascade, but as it used in multiples page, and some pages this is used twice.
I want to refresh after changing another combo or radio button.

in Telerik MVC Extensions we had something like this:
1.function onDropDownDataBinding(e) {
2.     var val1 = $('#First').data('tDropDownList').value();
3.     e.data = $.extend({}, e.data, {parameter: val1});
4.}
In other page, val1 would be from  $('#Other').data('tDropDownList').value()


How can we do this for Kendo UI DropDownList?

thanks,
Ezequiel
Alexander Popov
Telerik team
 answered on 23 May 2014
3 answers
409 views
I have a grid populated by data from ViewData, and the grid has a column containing an Edit button.  The problem is that the ClientTemplate that defines the Edit button is not showing the input button, rather it just shows the Id number as plain text.  I've used this same Edit button in another grid that is populated by a model, and it works fine.

Any ideas?  Thanks.  Dan
@(Html.Kendo().Grid((IEnumerable<Catheter>)ViewData["catheters"])
            .Name("CatheterGrid")
            .Columns(columns =>
            {
                columns.Bound(e => e.CatheterType.Name).Title("Type");
                columns.Bound(e => e.EffectiveDate).Title("Placed On").Format("{0:d}");
                columns.Bound(e => e.DiscontinuedOn).Title("Discontinued On");
                columns.Bound(e => e.Manufacturer.Name).Title("Manufacturer");
                columns.Bound(e => e.ClinicianDisplayName).Title("Clinician");
                columns.Bound(e => e.Id).Hidden();
                columns.Bound(e => e.Id).ClientTemplate(
                    "<a href='" + Url.Action("EditCatheter", Controllers.Patient) + "/#= Id #'" + "class='btn btn-sm'>Edit</a>"
                    ).Width(80).Title("");
            })
            .Pageable(pageable => pageable
                .PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
                .ButtonCount(5))
            .Sortable()
            .Filterable()
            .Scrollable()
            .ClientDetailTemplateId("template")
            .ToolBar(toolbar =>
            {
                toolbar.Template(@<text>
                    <div style="float:right">
                        <a href='@Url.Action("EditCatheter", Controllers.Patient)/0' class='btn btn-sm'>New</a>
                    </div>
                </text>);
            })
            )
Dimiter Madjarov
Telerik team
 answered on 23 May 2014
3 answers
487 views
Hi All,

I am creating the grid via javascript. The datasource is connected directly to the webservice. An example of the webservice result is the following:
[ { col1: "",
col2: "",
Items: [ { ....} }
}]

Instead of using the main result like col1 and col2 I need to use the Items. How can I specify that using the example below?

var locationItems = $("#grid").kendoGrid({
    columns: lockedGridColumns(),
    height: 500,
    scrollable: true,
    sortable: true,
    filterable: true,
    pageable: true,
    //reorderable: true,
    //resizable: true,
    autoBind: false
}).data("kendoGrid");

function getItems(locationId) {
    if (locationId == null) {
        locationId = 0;
    }   

var dataSource = new kendo.data.DataSource(locationId != 0 ?
            {
                transport: {
                    read: {
                        dataType: "json",
                        url: "api/items/getlocationitems?locationID=" + locationId
                    }
                },
                pageSize: 25
            } :
            {
                data: [],
                pageSize: 25
            });   

locationItems.setDataSource(dataSource);
    locationItems.dataSource.read();
}

Nikolay Rusev
Telerik team
 answered on 23 May 2014
0 answers
118 views
how to bind 1 lakh records using telerik tool in mvc5.
Simple
Top achievements
Rank 1
 asked on 23 May 2014
1 answer
902 views
I have a Razor page with a Kendo grid, trying to bind to ViewData.  The page is showing a syntax problem on the @(Html.Kendo().Grid line as shown below.  I can't figure out why the page won't render.  This is just like the example at
http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/server-binding

Dan
Controller code:
public ActionResult PatientMedInfo(long id)
        {
            IContextManager contextManager = ManagerConfig.GetManagerForUser(Session[SessionItems.AuthenticatedUser] as DHS.Entities.IDHSPrincipal);
            IWorkContext workContext = contextManager.Begin();
 
            DHS.Entities.Patient patient = workContext.GetPatientManager().GetById(id);
            ICollection<DHS.Entities.PatientCatheter> catheterlog = workContext.GetPatientManager().FindCatheters(patient);
 
            IEnumerable<Catheter> cats = catheterlog.Select(cat => new Catheter
            {
                Id = cat.Id,
                CatheterType = cat.CatheterType,
                EffectiveDate = cat.EffectiveDate,
                DiscontinuedOn = cat.DiscontinuedOn,
                Manufacturer = cat.Manufacturer,
                Clinician = cat.Clinician
            }).OrderBy(x => x.EffectiveDate);
 
            ViewData["catheters"] = cats;
 
            return View(Views.EmployeeMedInfo, CPR.WebPortal.Models.PatientMedInfo.Populate(workContext, workContext.GetPatientManager().GetById(id)));
        }
 
Razor page:
@model PatientMedInfo
 
@(Html.Kendo().Grid((IEnumerable<Catheter>)ViewData["catheters"])
            .Name("CatheterGrid")
            .Columns(columns =>
            {
                columns.Bound(e => e.CatheterType.Name).Title("Type");
                columns.Bound(e => e.EffectiveDate).Title("Placed On").Format("{0:d}");
                columns.Bound(e => e.DiscontinuedOn).Title("Discontinued On");
                columns.Bound(e => e.Manufacturer.Name).Title("Manufacturer");
                columns.Bound(e => e.ClinicianDisplayName).Title("Clinician");
                columns.Bound(e => e.Id).Hidden();
                columns.Bound(e => e.Id).ClientTemplate(
                    "<a href='" + Url.Action("EditCatheter", Controllers.Patient) + "/#= Id #'" + "class='btn btn-sm'>Edit</a>"
                    ).Width(80).Title("");
            })
            .Pageable(pageable => pageable
                .PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
                .ButtonCount(5))
            .Sortable()
            .Filterable()
            .Scrollable()
            .ClientDetailTemplateId("template")
            .ToolBar(toolbar =>
            {
                toolbar.Template(@<text>
                    <div style="float:right">
                        <a href='@Url.Action("EditCatheter", Controllers.Patient)/0' class='btn btn-sm'>New</a>
                    </div>
                </text>);
            })
Dan
Top achievements
Rank 2
 answered on 22 May 2014
1 answer
271 views
Hello,

I'm using a Grid in line edit mode to edit a list of contacts and I'm looking for a way to set a mask on the phone number and email.

Dimiter Madjarov
Telerik team
 answered on 22 May 2014
2 answers
150 views
Hi guys, I have a couple of question regarding custom templates inside a grid.

Simpliest of all: Is it possible to have a single save button for add action without enabling edit mode?
In other words, I'd like to allow add and delete from my grid; not edit.
and I'd like to save after each add.
If I don't define the edit action (and edit transport url) I can't see any save button...
Am I doing something wrong??

now for the main question...
First of all I have to say that I'm using EF and I set it so that foreing keys are not included in the model to keep it simple and clean
(istead of having a int foireign_key_id and a class foreign_class, I just have the class in my model)

now I have a view to edit a model; this model has some list in it..
public int ID { get; set; }
        public string NAME { get; set; }
        public string DESCRIPTION { get; set; }
     
        public virtual ICollection<OBJECT_ACCESS_T006> OBJECT_ACCESS_T006 { get; set; }
        public virtual ICollection<ROLE_FUNCTION_T010> ROLE_FUNCTION_T010 { get; set; }
        public virtual ICollection<USER_ROLE_T007> USER_ROLE_T007 { get; set; }

I'm working with User_Role list...
in my view I normally edit the first two fields and then I user a grid for the list..like this.

@(Html.Kendo().Grid<ROLE_FUNCTION_T010>(Model.ROLE_FUNCTION_T010)
                .Name("Grid")
                .ToolBar(commands => { commands.Create().Text(AcsViewRes.BtnNewFunct); })
                .Columns(columns =>
                {
                    columns.Bound(c => c.ID).Visible(false);
                    columns.ForeignKey("FUNCTION_T008", ViewBag.FunctionsList).ClientTemplate("#: data.FUNCTION_T008 ? FUNCTION_T008.NAME : '" + "empty" + "'#");
                    columns.Command(command => { command.Destroy().Text(AcsViewRes.SaveDestroy); command.Edit(); });
                 
                })
                .Pageable()
                .Sortable()
                .Filterable()
                .Editable(mode => mode.Mode(GridEditMode.InLine))
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(5)
                    .ServerOperation(false)
                    .Model(model =>
                    {
                        model.Id(v => v.ID);
                        model.Field(v => v.FUNCTION_T008).DefaultValue(ViewBag.DefaultFunction);
                    })
                    .Update(r => r.Action("LinkFunction", "Function"))
                    .Create(r => r.Action("LinkFunction", "Function"))
                    .Destroy(r => r.Action("RemoveFunction", "Function"))
                 )
            )

(as you can see from this code, the first question is related to this grid)
anyway, ma sub model (USER_ROLE_T007) is:

[Key]
        public int ID;
 
        [UIHint("FunctionDropDownTemplate")]
        public FUNCTION_T008 FUNCTION_T008;
 

@model FUNCTION_T008
 
@(
    Html.DropDownList(string.Empty, ViewBag.FunctionsList as SelectList)
)
    
            (from controller: ViewBag.FunctionsList = new SelectList(functions, "ID", "NAME");)

now the problem is that, when I save the function property is empty...
I know how to do it using the foreign key Id...I did it before, but I'd like to keep the model without them..
so, my goal is to have this list of functions which the user can add or remove (actually is link and unlink), and on add user is prompt with a drop down list conteining all functions.

is that possible?

Thanks
Fabio
Gaetano
Top achievements
Rank 1
 answered on 22 May 2014
1 answer
190 views
Hi,

I have created a KendoDiagram using the code below. The data returned is a bit longer than below but esentially it returns 30 items at 3 levels of hierarchy. Everything works great if I have the Stroke Width set to 0. However
if the width is set to >0 the connectors look really untidy as can be seen in the attachment.

Is it possible to change the connector so that instead of going into the top centre of the shape they go into the centre left of the shape?

Thanks

Controller
        public JsonResult GetDiagramData()
        {
            var coo = new ManagementStructure() { Name = "AS", JobRole = "Chief" };

            var aj = new ManagementStructure { Name = "AJ", JobRole = "Regional" };
            var cd = new ManagementStructure { Name = "CD", JobRole = "Regional" };
            var kf = new ManagementStructure { Name = "KF", JobRole = "Regional" };
            var mc = new ManagementStructure { Name = "MC", JobRole = "Regional" };
            var sm = new ManagementStructure { Name = "SM", JobRole = "Regional" };
            var te = new ManagementStructure { Name = "TE", JobRole = "Regional" };

            coo.Items.Add(aj);
            coo.Items.Add(cd);

            aj.Items.Add(new ManagementStructure { Name = "KM", JobRole = "Area" });
            aj.Items.Add(new ManagementStructure { Name = "LW", JobRole = "Area" });

            cd.Items.Add(new ManagementStructure { Name = "AG", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "DE", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "DT", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "FT", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "JD", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "NM", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "PF", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "RW", JobRole = "Area" });
            cd.Items.Add(new ManagementStructure { Name = "SF", JobRole = "Area" });

            kf.Items.Add(new ManagementStructure { Name = "AC", JobRole = "Area" });
            kf.Items.Add(new ManagementStructure { Name = "EW", JobRole = "Area" });
            kf.Items.Add(new ManagementStructure { Name = "HS", JobRole = "Area" });

            var managers = new List<ManagementStructure> { coo };

            return Json(managers, JsonRequestBehavior.AllowGet);
        }

<script>
    function visualTemplate(options) {
        var dataviz = kendo.dataviz;
        var g = new dataviz.diagram.Group({
            autoSize: true
        });
        var dataItem = options.dataItem;
 
        g.append(new dataviz.diagram.Rectangle({
            width: 150,
            height: 50,
            stroke: {
                width: 0
            },
            background: "#1696d3"
        }));
 
        g.append(new dataviz.diagram.TextBlock({
            text: dataItem.Name,
            x: 5,
            y: 10,
            color: "#fff"
        }));
 
        g.append(new dataviz.diagram.TextBlock({
            text: dataItem.JobRole,
            x: 5,
            y: 30,
            color: "#fff"
        }));
 
        return g;
    }
</script>
 
<h2>Test Hierarchy</h2>
 
<div id="canvas" class="diagram-wrapper" style="margin: auto;">
    @(Html.Kendo().Diagram()
           .Name("diagram")
           .DataSource(dataSource => dataSource
               .Read(read => read.Action("GetDiagramData", "Home")).Model(m => m.Children("Items"))
           )
           .Layout(l => l.Type(DiagramLayoutType.Tree))
           .Layout(l => l.Subtype(DiagramLayoutSubtype.Tipover))
           .ShapeDefaults(sd => sd.Visual("visualTemplate").Stroke(s => s.DashType("dashDot")).Editable(false).Rotatable(false).Resizable(false)).Draggable(false)
           .ConnectionDefaults(cd => cd.Stroke(s => s.Color("#979797").Width(0)))
    )
</div>
<script>
    $(function () {
        // Notice that the Name() of the diagram is used to get its client-side instance
        var diagram = $("#diagram").data("kendoDiagram");
        diagram.zoom(0.75);
    });
</script>
Hristo Germanov
Telerik team
 answered on 22 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?