Telerik Forums
UI for ASP.NET MVC Forum
1 answer
125 views

hello telerik.

i'm using telerik gantt chart mvc.

i have added one more button and dialog box to handle one more ResourceAssignment in my chart control. the 2nd one is all the customized dialog box to show new resource assignments.

now i'm facing an issue in showing the new ResourceAssignments data in New Column side by the original ResourceAssignment column at treeview side.

i want to show both resource assignments data in two separate columns. currently both resource's data is showing in the same column that is not what i want.

i've attached images for clarification

Veselin Tsvetanov
Telerik team
 answered on 17 Jan 2018
13 answers
140 views

Hey Telerik Team ! 

I've a requirement in my Gantt Chart for MVC.

Same like Resource Assignment Dialog i need to put one more thing (Cars) in a separate dialog box like resources dialog from where the Cars will be assigned to a particular task same like Resource Assignment to a particular task.

How can i do this in Telerik Gantt Chart For MVC ? 

Nabil
Top achievements
Rank 1
 answered on 17 Jan 2018
2 answers
166 views

Hello. When I am exporting to PDF, the aggregate row is displaying on a new page though there is space in the previous page. See attached file.

The settings for generating the pdf are as follows:

              .Pdf(pdf => pdf
              .AllPages()
              .PaperSize("A4")
              .Scale(0.6)
              .Margin("30mm", "10mm", "30mm", "10mm")
              .Landscape()
              .RepeatHeaders()
              .TemplateId("page-template")
              .FileName("Combined Summary Report.pdf")
              .ProxyURL(Url.Action("Pdf_Export_Save", "CombinedSummaryReport"))
          )

 

I have tried changing the values for the top and bottom margins, but then some records are not displaying.

Any help will be much appreciated.

Thanks

 

Daniel
Top achievements
Rank 1
 answered on 16 Jan 2018
5 answers
317 views

Hello Telerik Team !

I'm using telerik gantt chart for MVC

i want to ask can i manipulate tasks data before it get's bind to the chart ?

like when READ action for task data source gets fired and get the data from server and then at client side before binding tasks to chart it can be changed.

 

can i do that ? kindly tell.

 

Thank You.

Veselin Tsvetanov
Telerik team
 answered on 15 Jan 2018
6 answers
2.9K+ views

Hi Progress team!

 

I have a master grid and a details grid both using Ajax binding. I'm trying to add a button using ClientTemplate for both grids. It works fine for the master grid and fails for the details grid.

Here is the code for the grids:

001.@(Html.Kendo().Grid<dynamic>()
002.            .Name("gridServiceResults")
003.            .DataSource(dataSource =>
004.            {
005.                dataSource.Ajax().Events(e => e.RequestStart("gridRequestStart")).Model(m =>
006.                {
007.                    if (Model.PrimaryKey.Count() == 0)
008.                    {
009.                        throw new Exception("Service Configuration does not include an id column");
010.                    }
011.                    var id = Model.PrimaryKey[0].ColumnName;
012.                    m.Id(id);
013. 
014.                    foreach (DataColumn column in Model.Columns)
015.                    {
016.                        var field = m.Field(column.ColumnName, column.DataType);
017.                    }
018.                })
019.                .Sort(sort =>
020.                {
021.                    // SortFields = List<SortField>
022.                    foreach (var sortField in ViewBag.SortFields)
023.                    {
024.                        var sortToAdd = sort.Add(Model.Columns[sortField.Name].ColumnName);
025.                        if (sortField.SortDirection == DynamicPoint.Office365.CustomerVendorPortal.Common.Models.SortDirection.Descending)
026.                        {
027.                            sortToAdd.Descending();
028.                        }
029.                        else
030.                        {
031.                            sortToAdd.Ascending();
032.                        }
033.                    }
034.                })
035.                .PageSize((int)this.ViewData["PageSize"])
036.                .Read(read => read.Action("Read", "Home", ViewBag.RouteValues).Data("getReadData()"));
037.            })
038.            .Columns(columnFactory =>
039.            {
040.                foreach (DataColumn column in Model.Columns)
041.                {
042.                    if (column.Caption != Constants.ResultDataTableSchema.HiddenCaption)
043.                    {
044.                        var c = columnFactory.Bound(column.DataType, column.ColumnName).HeaderHtmlAttributes(new { @class = "test-class" });
045.                        c.Title(column.Caption);
046.                        if (column.DataType == typeof(DateTime))
047.                        { c.Format("{0:d}"); }
048.                        if (column.DataType == typeof(Boolean))
049.                        {
050.                            c.HtmlAttributes(new { style = "text-align: center;" }).ClientTemplate("<input type='checkbox' disabled='disabled' " + "# if (" + column.ColumnName + ") { #" + "checked='checked'" + "# } #" + "/>");
051.                            c.HeaderHtmlAttributes(new { style = "text-align: center;" });
052.                        }
053.                        if (column.DataType == typeof(Int32))
054.                        {
055.                            c.HtmlAttributes(new { style = "text-align: right;" });
056.                            c.HeaderHtmlAttributes(new { style = "text-align: right" });
057.                        }
058.                        if ((column.DataType == typeof(Decimal)) || (column.DataType == typeof(float)) || (column.DataType == typeof(double)))
059.                        {
060.                            c.HtmlAttributes(new { style = "text-align: right;" }).Format("{0:n}");
061.                            c.HeaderHtmlAttributes(new { style = "text-align: right" });
062.                        }
063.                    }
064.                }
065.                if (ViewBag.DetailsFormEnabled)
066.                {
067.                    columnFactory.Template(@<text></text>).ClientTemplate("#= serviceResultCommands(data) #");
068.                }
069.            })
070.            .Scrollable(s => s.Height(770))
071.            .ClientDetailTemplateId("gridResultChildItemsTemplate")
072.            .Resizable(x => x.Columns(true))
073.            .Filterable()
074.            .Sortable()
075.            .Pageable(x => x.PageSizes(new int[] { (int)this.ViewData["PageSize"], 10, 25, 50, 100 }).Numeric(true).Info(true).Input(true).Refresh(true))
076.)
077. 
078.<script id="gridResultChildItemsTemplate" type="text/kendo-tmpl">
079.    @(Html.Kendo().Grid<dynamic>()
080.            .Name("gridServiceResultChildItems_#=" + Model.PrimaryKey[0].ColumnName + "#")
081.            .DataSource(dataSource =>
082.            {
083.                dataSource.Ajax().Events(e => e.RequestStart("gridRequestStart")).Model(m =>
084.                {
085.                    if ((this.ViewBag.ChildItemViewModel.PrimaryKey != null) && (this.ViewBag.ChildItemViewModel.PrimaryKey.Length > 0))
086.                    {
087.                        var id = this.ViewBag.ChildItemViewModel.PrimaryKey[0].ColumnName;
088.                        m.Id(id);
089.                    }
090. 
091.                    foreach (DataColumn column in this.ViewBag.ChildItemViewModel.Columns)
092.                    {
093.                        var field = m.Field(column.ColumnName, column.DataType);
094.                    }
095.                })
096.                .Sort(sort =>
097.                {
098.                    // SortFields = List<SortField>
099.                    foreach (var sortField in ViewBag.ChildGridSortFields)
100.                    {
101.                        var sortToAdd = sort.Add(this.ViewBag.ChildItemViewModel.Columns[sortField.Name].ColumnName);
102.                        if (sortField.SortDirection == DynamicPoint.Office365.CustomerVendorPortal.Common.Models.SortDirection.Descending)
103.                        {
104.                            sortToAdd.Descending();
105.                        }
106.                        else
107.                        {
108.                            sortToAdd.Ascending();
109.                        }
110.                    }
111.                })
112.                .Read(read => read.Action("ReadChildItems", "Home", this.ViewBag.RouteValues).Data("getChildItemsReadData('#=" + Model.PrimaryKey[0].ColumnName + "#')"));
113.            })
114.            .Columns(columnFactory =>
115.            {
116.                foreach (DataColumn column in this.ViewBag.ChildItemViewModel.Columns)
117.                {
118.                    var c = columnFactory.Bound(column.DataType, column.ColumnName);
119.                    c.Title(column.Caption);
120.                    if (column.DataType == typeof(DateTime))
121.                    { c.Format("{0:d}"); }
122.                    if (column.DataType == typeof(Boolean))
123.                    {
124.                        c.HtmlAttributes(new { style = "text-align: center" }).ClientTemplate("<input type='checkbox' disabled='disabled' " + "# if (" + column.ColumnName + ") { #" + "checked='checked'" + "# } #" + "/>");
125.                    }
126.                    if (column.DataType == typeof(Int32))
127.                    {
128.                        c.HtmlAttributes(new { style = "text-align: right" });
129.                        c.HeaderHtmlAttributes(new { style = "text-align: right" });
130.                    }
131.                    if ((column.DataType == typeof(Decimal)) || (column.DataType == typeof(float)))
132.                    {
133.                        c.HtmlAttributes(new { style = "text-align: right" }).Format("{0:n}");
134.                        c.HeaderHtmlAttributes(new { style = "text-align: right" });
135.                    }
136.                }
137.                if (ViewBag.DetailsFormEnabled)
138.                {
139.                    columnFactory.Template(@<text></text>).ClientTemplate("#= serviceChildResultCommands(data) #");
140.                }
141.            })
142.            .Events(ev => ev.DataBound("onGridDataBound"))
143.            .Sortable()
144.            .ToClientTemplate()
145.)
146.</script>

 

Here is the code for the client templates for the buttons:

1.<script id="service-result-commands-template" type="text/x-kendo-template">
2.    <button type="button" role="button" class="k-button k-button-icontext" data-dp-recordId="#=Annotations_Id_Key_Only#" onclick="navigateToDetailsForm(this)"><span class="k-icon k-i-edit"></span>View / Edit</button>
3.</script>
4. 
5.<script id="service-child-result-commands-template" type="text/x-kendo-template">
6.    <button type="button" role="button" class="k-button k-button-icontext" data-dp-recordId="" onclick="navigateToDetailsForm(this)"><span class="k-icon k-i-edit"></span>View / Edit</button>
7.</script>

 

Here is the code for my javascript functions:

01.function serviceResultCommands(model) {
02.    debugger;
03.    return kendo.Template.compile($('#service-result-commands-template').html())(model);
04.}
05. 
06.function serviceChildResultCommands(model) {
07.    debugger;
08.    return kendo.Template.compile($('#service-child-result-commands-template').html())(model);
09.}

 

When I try to expand the details grid I get this error (it fails on line 08 in the above shippet):

Uncaught SyntaxError: Invalid or unexpected token at eval (<anonymous>) ...

The code is the same for the master and the details grid, but it only fails when the details grid is expanded and no data is rendered in that grid. It looks like the compile functions completes without error but then it fails on the next call.

I'm also attaching a screen shot of the error.

Please help!

Thanks!

Kiril

 

 

Kiril
Top achievements
Rank 2
 answered on 15 Jan 2018
1 answer
1.2K+ views
I am getting out of memory exception, when exporting huge amount of data (50000 rows spread in around 50 columns) to excel from Kendo Grid (MVC).
Is there any limitation on the number of rows that can be exported to excel ? If there is no limitation, what other methods can I use to successfully export data to excel ?
Can RadSpreadStreamProcessing be used to export to excel from Kendo Grid? Can I get sample code for that?
Stefan
Telerik team
 answered on 15 Jan 2018
1 answer
158 views

I have done a typescript update to the latest version 2.6 from 2.3 and on building my application in visual studio am getting a number of errors occurring in the custom ts files as well as kendo-ui.d.ts  see attached file)...

Is there a solution for this?

 

Viktor Tachev
Telerik team
 answered on 15 Jan 2018
3 answers
2.2K+ views

I am trying to reduce the amount of back-and-forth on a number of columns that are configured to use multi-checkbox filtering, as per the below example:

.Columns(columns => { columns.Bound(c => c.Status).Filterable(f => f.Multi(true) })

I would like to set the available values of this filter. The default behaviour is for the entire dataset to be re-requested and returned to the user, where a distinct list of values can be deduced. I am able to implement a more efficient solution for my particular case, but I cannot seem to set the available values of these filters. Finding the relevant th object and setting the data as follows does not seem to work:

var myGrid = $("#MyGrid").data("kendoGrid");
var listOfFilterValues = [{"Status": "first"},{"Status": "second"},{"Status": "etc"}];
myGrid.thead.find("th").each(function (i,s) {
    if($(s).data("field") == "Status" && $(s).data("kendoFilterMultiCheck") != null){
        $(s).data("kendoFilterMultiCheck").checkSource.data(listOfFilterValues );
    }
}

Is this possible? If so, how?

Tsvetina
Telerik team
 answered on 15 Jan 2018
8 answers
601 views

Using the scheduler-custom-editor project as a guide I've created a custom editor template and have added a number of fields as needed for our project. One of these is a Kendo ListView that I used in another project to retrieve a number images from a web service. This all seems to be working fine but one thing I'm stuck on is writing the filename of the clicked image to a text field on the template (see screenshot). Relevant template code is:

 

<div class="k-edit-label">
    Image Details
</div>
<div class="eventimage-section k-content wide">
    <div id="listView" class="k-edit-field"></div>
    <div id="pager" class="k-pager-wrap"></div>
</div>


<script type="text/x-kendo-template" id="template">
    <div class="eventimage">
        <img src="http://nsccapi/eventimages/\\#= FileName \\#" alt="\\#: FileName \\# image" />
            <h3>\\#: FileName \\#</h3>
        </div>
</script>

<script>

var dataSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: "http://myapi/api/events/allimages",
            dataType: "jsonp"
        }
    },
    pageSize: 3
});

$("\\#pager").kendoPager({
    dataSource: dataSource
});

$("\\#listView").kendoListView({
    dataSource: dataSource,
    selectable: "single",
    @* change: onChange,*@
    template: kendo.template($("\\#template").html()),
    autoBind: false
});

dataSource.read(); // "read()" will fire the "change" event of the dataSource and the widget will be bound

@* function onChange() {

//    var data = dataSource.view(),
//        selected = $.map(this.select(), function (item) {
//            var sel = data[$(item).index()].FileName;
//            $("\\#ImagePath").val(sel)
//            return sel;
//        });

    } *@



</script>

 

The ListView renders the images as expected but the change event (change: onChange) of the listview fails saying that onChange is not defined. I've commented it out in my code as shown above. #ImagePath is the id of the text field I wish to write to. Am I going about this the correct way? Should I instead handle a click event on an image and grab it's filename from the <h3> tag?

Thanks.

 

Dimitar
Telerik team
 answered on 15 Jan 2018
4 answers
224 views

Upon saving and clearing all validation steps with a pop-up template, I get the following error:

 

VM5294:3 Uncaught TypeError: Cannot read property 'PatientId' of null
    at Object.eval [as PatientId] (eval at getter (https://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js:25:30967), <anonymous>:3:10)
    at y (https://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js:27:627)
    at init.data (https://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js:27:982)
    at init._accept (https://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js:27:27729)
    at Object.<anonymous> (https://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js:27:26672)
    at Object.<anonymous> (https://kendo.cdn.telerik.com/2017.1.223/js/jquery.min.js:2:28768)
    at i (https://kendo.cdn.telerik.com/2017.1.223/js/jquery.min.js:2:27449)
    at Object.fireWith [as resolveWith] (https://kendo.cdn.telerik.com/2017.1.223/js/jquery.min.js:2:28213)
    at Object.e.(anonymous function) [as resolve] (https://kendo.cdn.telerik.com/2017.1.223/js/jquery.min.js:2:29192)
    at Object.success (https://kendo.cdn.telerik.com/2017.1.223/js/kendo.all.min.js:27:29810)

 

What's interesting is that DELETE functions work but not Update Create

 

Here is my code for the grid

 

@using AccuChart.Controllers;
@using AccuChart.Models;
@using AccuChart.ViewModels;

@model PatientViewModel

@{
    ViewBag.Title = "Patients";
}

<h3>Patients</h3>


@(Html.Kendo().Grid(Model.Patients)
    .Name("patientGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.FirstName).Title("First Name").Filterable(true);
        columns.Bound(p => p.LastName).Title("Last Name").Filterable(true);
        columns.Bound(p => p.PatientId).Visible(false);
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_Patient")
            .Window(w => w.Title("Edit Patient").Name("Patient"))
    )
    .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .ButtonCount(3))
    .Sortable()
    .Scrollable()
    //.HtmlAttributes(new { style = "height:550px;" })
    .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
    .DataSource(dataSource => dataSource
        .Ajax().ServerOperation(false)
        .PageSize(20)
        .Model((model => model.Id(patient => patient.PatientId)))
        .Read(read => read.Action("GetPatients", "Patient"))
        .Create(create => create.Action("EditingPopup_Create", "Patient"))
        .Update(update => update.Action("EditingPopup_Update", "Patient"))
        .Destroy(delete => delete.Action("EditingPopup_Delete", "Patient"))
        .Events(e =>
        {
            e.RequestEnd("onGridDataSourceRequestEnd");
            e.Error("onError");
        })
        .Sort(sort => sort.Add("FullName"))
       )
)
<script type="text/javascript">
    function onError(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }

    function onGridDataSourceRequestEnd(e) {
        // Check request type
        if (e.type == "create" || e.type == "update") {
            //check for errors in the response
            if (e.response == null || e.response.Errors == null) {
                $('#patientGrid').data().kendoGrid.dataSource.read();
            }
            else {
                alert("Update Failed");
            }
        }
    }

</script>
<style>
    .k-header.k-grid-toolbar, .k-button.k-button-icontext.k-grid-add, .k-window-titlebar.k-header {
        background-color: #393536;
        border-color: #605d5e;
    }

        .k-button.k-button-icontext.k-grid-add:hover {
            background-color: #605d5e;
            border-color: #4c494a;
        }
</style>

 

The pop-up editor

 

@using AccuChart.Controllers;
@using AccuChart.Models;
@using AccuChart.ViewModels;


@(Html.Kendo().TabStrip().Animation(false)
                .Name("tabstrip")
                .Items(tabstrip =>
                {
                  tabstrip.Add().Text("Patient Information")
                                  .Selected(true)
                                  .Content(@<text>
@Html.HiddenFor(m => m.PatientId)
@Html.HiddenFor(m => m.ClinicId)


        <div class="editor-label">
            @Html.LabelFor(m => m.FirstName)
        </div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.FirstName).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.FirstName)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.MiddleName)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.MiddleName).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.MiddleName)
    </div>


    <div class="editor-label">
    @Html.LabelFor(m => m.LastName)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.LastName).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.LastName)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.Address1)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.Address1).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.Address1)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.Address2)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.Address2).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.Address2)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.City)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.City).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.City)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.State)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.State).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.State)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.Zip)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.Zip).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.Zip)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.HomePhone)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.HomePhone).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.HomePhone)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.CellPhone)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.CellPhone).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.CellPhone)
    </div>

   <div class="editor-label">
    @Html.LabelFor(m => m.Email)
</div>
    <div>
        @Html.Kendo().TextBoxFor(m => m.Email).HtmlAttributes(new { style = "width:100%" })
        @Html.ValidationMessageFor(m => m.Email)
    </div>

    <div class="editor-label">
    @Html.LabelFor(m => m.PreferContact)
</div>
    <div>
        @(Html.Kendo().DropDownListFor(m => m.PreferContact)
                        .HtmlAttributes(new { style = "width:100%" })
                        .DataTextField("Name")
                        .DataValueField("Name")
                        .DataSource(ds =>
                        {
                            ds.Read(read => read.Action("GetModeContact", "Patient"));
                        })
                        .AutoBind(true)
        )
        @Html.ValidationMessageFor(m => m.PreferContact)
    </div>

</text>);

tabstrip.Add().Text("Insurance").Content(@<text>


        <div class="editor-label">
    @Html.LabelFor(m => m.InsuranceCompany)
</div>
        <div>
            @Html.Kendo().TextBoxFor(m => m.InsuranceCompany).HtmlAttributes(new { style = "width:100%" })
            @Html.ValidationMessageFor(m => m.InsuranceCompany)
        </div>

        <div class="editor-label">
    @Html.LabelFor(m => m.InsuranceGroupNumber)
</div>
        <div>
            @Html.Kendo().TextBoxFor(m => m.InsuranceGroupNumber).HtmlAttributes(new { style = "width:100%" })
            @Html.ValidationMessageFor(m => m.InsuranceGroupNumber)
        </div>

        <div class="editor-label">
    @Html.LabelFor(m => m.InsurancePolicyNumber)
</div>
        <div>
            @Html.Kendo().TextBoxFor(m => m.InsurancePolicyNumber).HtmlAttributes(new { style = "width:100%" })
            @Html.ValidationMessageFor(m => m.InsurancePolicyNumber)
        </div>

        <div class="editor-label">
    @Html.LabelFor(m => m.InsurancePolicyHolderName)
</div>
        <div>
            @Html.Kendo().TextBoxFor(m => m.InsurancePolicyHolderName).HtmlAttributes(new { style = "width:100%" })
            @Html.ValidationMessageFor(m => m.InsurancePolicyHolderName)
        </div>


</text>);

}))

@model PatientModel

 

The controller

 

using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AccuChart.ViewModels;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
using AccuChart.Models;
using System.Collections.Generic;

namespace AccuChart.Controllers
{
    public class PatientController : BaseController
    {
        public ActionResult Index(int id=1)
        {
            PatientViewModel p = new PatientViewModel();
            p.Patients = _patientSvc.GetByClinicId(id);

            return View(p);
        }

         
        public ActionResult GetPatients([DataSourceRequest]DataSourceRequest request, int patientId=0)
        {
            var result = _patientSvc.GetByClinicId(CurrentClinicId).ToDataSourceResult(request);
            return Json(result, JsonRequestBehavior.AllowGet);
        }

        public JsonResult GetModeContact()
        {
            List<ModeContactModel> mode = new List<ModeContactModel>();
            mode.Add(new ModeContactModel { Name = "Home Phone" });
            mode.Add(new ModeContactModel { Name = "Cell Phone" });
            mode.Add(new ModeContactModel { Name = "Email" });


            return Json(mode, JsonRequestBehavior.AllowGet);
        }


        //CRUD operations
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult EditingPopup_Create([DataSourceRequest] DataSourceRequest request, PatientModel patient)
        {
            PatientModel presult = null;
            //var user = _userSvc.GetByEmail(this.CurrentUserEmail);

            if (patient != null && ModelState.IsValid)
            {
                presult = _patientSvc.Create(patient, 1);

            }
            return Json(new[] { presult }.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult EditingPopup_Update([DataSourceRequest] DataSourceRequest request, PatientModel patient)
        {
            PatientModel presult = null;
           // var user = _userSvc.GetByEmail(this.CurrentUserEmail);

            if (patient != null && ModelState.IsValid)
            {
                presult = _patientSvc.Update(patient, 1);

            }
            return Json(new[] { presult }.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult EditingPopup_Delete([DataSourceRequest] DataSourceRequest request, PatientModel patient)
        {
            if (patient != null && ModelState.IsValid)
            {
                _patientSvc.Delete(patient);

            }
            return Json(new[] { patient }.ToDataSourceResult(request, ModelState));
        }


    }
}

 

 

 

Dan
Top achievements
Rank 1
 answered on 13 Jan 2018
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?