Telerik Forums
UI for ASP.NET MVC Forum
7 answers
2.4K+ views

Hi 

I want to load the Normal view as a modal window when  kendo Toolbar button is clicked. Inside View I am calling Partial view as a whole form. (inside form there are another 2 partial views along with another inputs and 2 submit buttons).

But form is not loading as modal form instead it loads as normal form displaying url action route (GET request). Could you please help me what changes needed to get the ActionResult View loads as a Modal window.  when submit I need to execute POST method. but my GET method is not displaying correctly as a modal window.  

 

[HttpGet]
       public ActionResult AddStructureNode(string currrentNode)
       {
           List<CustomerReference> _CustomerReferenceList = null;
 
           AddStructureNode addNode = new Infrastructure.AddStructureNode();
           Structure oStructure = new Structure();
 
           addNode.LoadScreen(0);
           addNode.UserOnly = true;
           _CustomerReferenceList = addNode.CustomerReferenceList;
           return PartialView("_AddStructureNode",addNode);
 
       }
 
[HttpPost]
       public ActionResult AddStructureNode()
       {
           return View();
       }

 

AddStructureNode View 

@model StB.Infrastructure.AddStructureNode
 
 
    <div id="window">
        @Html.Partial("_AddStructureNode", Model)
    </div>

 

Partial View (_AddStructureNode)

@model StB.Infrastructure.AddStructureNode
 
@{
    Layout = null;
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/kendo")
    @Scripts.Render("~/bundles/jquery-ui")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/SBScripts")
}
 
<div>
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
 
 
        <div class="form-horizontal">
 
            @Html.Hidden("orgCode")
            @Html.Hidden("siteCode")
            @Html.Hidden("clientCode")
            @Html.Hidden("systemID")
 
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-11"><h3>Add New Structure</h3></div>
            </div>
 
            <hr />
 
 
            @Html.ValidationSummary(true)
 
            @if ((bool)HttpContext.Current.Session["divNoItem-visible"] == true)
            {
                <div id="divNoItem"></div>
            }
 
 
            <div id="trLevel" class="row">
                <div class="col-md-4"></div>
                <div class="col-md-4">
                    <div class="form-group">
                        @Html.Label("Level", new { @class = "col-md-3 control-label" })
                        <div class="col-md-9">
                            @Html.TextBoxFor(m=>m.NewStructure.NextLevel, new { style = "width:185px;", @readonly = "readonly", data_toggle = "tooltip", data_placement = "right", title = "Level is ready only" })
                            @Html.TextBoxFor(m=>m.NewStructure.NextLevelDescription, new { style = "width:185px;", @readonly = "readonly", data_toggle = "tooltip", data_placement = "right", title = "Level Details is ready only" })
                        </div>
                    </div>
                </div>
                <div class="col-md-4"></div>
            </div>
 
            @if ((bool)HttpContext.Current.Session["Code-visible"] == true)
            {
                <div id="trCode" class="row">
                    <div class="col-md-4"></div>
                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.Label("Structure", new { @class = "col-md-3 control-label" })
                            <div class="col-md-9">
                                @Html.TextBox("txtCode", "", new { style = "width:185px;", @readonly = "readonly", data_toggle = "tooltip", data_placement = "right", title = "Level is ready only" })
                                @Html.TextBox("txtDescription", "", new { style = "width:185px;", @readonly = "readonly", data_toggle = "tooltip", data_placement = "right", title = "Level Details is ready only" })
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4"></div>
                </div>
            }
 
            @if ((bool)HttpContext.Current.Session["ItemDisplay-visible"] == true)
            {
                <div id="trItemDisplay" class="row">
                    <div class="col-md-4"></div>
                    <div class="col-md-4">
                        <div class="form-group">
                            @Html.Label("Items", new { @class = "col-md-3 control-label" })
                            <div id="tvStructureDisplay" class="col-md-9">                             
                                @Html.Partial("_StructureDisplayTreeView", HttpContext.Current.Session["LoadedStructures"] as IEnumerable<StB.Models.Structure>)
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4"></div>
                </div>
            }
         
 
 
            <div class="row">
                <div class="col-md-4"></div>
                <div class="col-md-4">
                    <div class="form-group">
                        <div class="col-md-4"></div>
                        <div class="col-md-4">
                            <button id="AddNode" type="submit" value="Add" name="btnSearch" class="buttonmed pull-right" data-toggle="tooltip" , title="Press this button to Add Node">Add</button>
                        </div>
                        <div class="col-md-4">
                            <button id="Close" type="submit" value="Clear" class="buttonmed" name="btnClear" data-toggle="tooltip" , title="Press this button to close">Close</button>
                        </div>
                        @*<div class="col-md-6"></div>*@
                    </div>
                </div>
                <div class="col-md-4"></div>
            </div>
            
 
        </div>
    }
    
</div>

 

SBScripts file Scripts

var myWindow = $("#window");
 
function onClose() {
    //   undo.fadeIn();
    myWindow.close;
}
 
myWindow.kendoWindow({
    width: "600px",
    title: "Add Node Structure",
    visible: false,
    actions: [
        "Pin",
        "Minimize",
        "Maximize",
        "Close"
    ],
    close: onClose,
    open:onOpen
}).data("kendoWindow");
 
 
function onOpen(myWindow) {
    myWindow.open();
}
 
$(document).ready(function () {
    $("form.k-edit-form").kendoValidator();
});
 
 
toolbar button click event
 
function ShowDialog(e) {
    var structurecode = $('#hdnstructureCode').val();
    var url = '/HierarchyBuilder/AddStructureNode';
    
    alert("St Code : " + structurecode);
    $.ajax({
        url: url,
        type: 'GET',
        data: { 'StructureCode': structurecode },
        dataType: 'json',
        async: true,
        cache: false,
        complete: function () {
            // $('#progress').hide();
        },
        success:             
            callbackFuntion(url)      
    });
}
 
 
function callbackFuntion(_url) {
    window.location = _url;
}

 

I call ShowDialog event when kendo toolbar button is clicked. so I have to load the form via ajax. 

Could you please show me where in my scripts has to be changed. I tried Content and Refresh methods but not successful. Thanks.

Thusith

 


Nencho
Telerik team
 answered on 26 Jan 2018
5 answers
210 views

Using the SchedulerCustomEditor as a sample project I've created a project where the user can manage Events, both individual and recurring. I'm using EF6 to manage read/write to the database. My database has an Events table which has a many-to-many relationship with Categories and a many to many relationship with Locations (see attached). 

Add and Edit events (and their related categories) seems to work fine, recurring events and recurrence exceptions are getting created, updated properly, delete works fine until  a recurring event has a recurrence exception. An exception is thrown by Entity Framework: "Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded." Stepping through my delete function the calls to delete the recurrence exception event and it's parent occur almost simultaneously, I've notice similar in the Delete function in the SchedulerCustomEditor sample project:

 

        public virtual void Delete(MeetingViewModel meeting, ModelStateDictionary modelState)
        {
            if (meeting.Attendees == null)
            {
                meeting.Attendees = new int[0];
            }

            var entity = meeting.ToEntity();

            db.Meetings.Attach(entity);

            var attendees = meeting.Attendees.Select(attendee => new MeetingAttendee
            {
                AttendeeID = attendee,
                MeetingID = entity.MeetingID
            });

            foreach (var attendee in attendees)
            {
                db.MeetingAttendees.Attach(attendee);
            }

            entity.MeetingAttendees.Clear();

            var recurrenceExceptions = db.Meetings.Where(m => m.RecurrenceID == entity.MeetingID);

            foreach (var recurrenceException in recurrenceExceptions)
            {
                db.Meetings.Remove(recurrenceException);
            }

            db.Meetings.Remove(entity);
            db.SaveChanges();
        }

Can't say I really understand what is going on in the above function with the Attach calls. In the above function you are manually removing the records MeetingAttendees join table somehow, but in my scenario I have no access to these join tables.

 

My Delete function is:

 

        public virtual void Delete(EventScheduleViewModel evt, ModelStateDictionary modelState)
        {
            if (evt.Categories == null)
            {
                evt.Categories = new int[0];
            }
            if (evt.Locations == null)
            {
                evt.Locations = new int[0];
            }

            var entity = db.Events.Include("Categories").Include("Locations").FirstOrDefault(m => m.EventID == evt.EventID);

            foreach (var category in entity.Categories.ToList())
            {
                entity.Categories.Remove(category);
            }

            foreach (var location in entity.Locations.ToList())
            {
                entity.Locations.Remove(location);
            }

            var recurrenceExceptions = db.Events.Where(m => m.RecurrenceID == entity.EventID);

            foreach (var recurrenceException in recurrenceExceptions)
            {
                db.Events.Remove(recurrenceException);
            }

            db.Events.Remove(entity);
            try
            {
                db.SaveChanges();
            }

            catch (Exception e)
            {
                throw;
            }
        }

 

here's my Insert and Update functions which seem to be working ok:

 

        public virtual void Insert(EventScheduleViewModel evt, ModelStateDictionary modelState)
        {
            if (ValidateModel(evt, modelState))
            {
                if (evt.Categories == null)
                {
                    evt.Categories = new int[0];
                }
                if (evt.Locations == null)
                {
                    evt.Locations = new int[0];
                }

                var entity = evt.ToEntity();

                foreach (var categoryId in evt.Categories)
                {
                    var category = db.Categories.FirstOrDefault(s => s.CategoryID == categoryId);
                    if (category != null)
                    {
                        entity.Categories.Add(category);
                    }
                }

                foreach (var locationId in evt.Locations)
                {
                    var location = db.Locations.FirstOrDefault(s => s.LocationID == locationId);
                    if (location != null)
                    {
                        entity.Locations.Add(location);
                    }
                }

                try
                {
                    db.Events.Add(entity);
                    db.SaveChanges();
                }

                catch (Exception)
                {
                    throw;
                }

                evt.EventID = entity.EventID;
            }
        }

        public virtual void Update(EventScheduleViewModel evt, ModelStateDictionary modelState)
        {
            if (ValidateModel(evt, modelState))
            {

                var entity = db.Events.Include("Categories").Include("Locations").FirstOrDefault(m => m.EventID == evt.EventID);

                entity.Title = evt.Title;
                entity.Start = evt.Start;
                entity.End = evt.End;
                entity.Description = evt.Description;
                entity.IsAllDay = evt.IsAllDay;
                entity.RecurrenceID = evt.RecurrenceID;
                entity.RecurrenceRule = evt.RecurrenceRule;
                entity.RecurrenceException = evt.RecurrenceException;
                entity.StartTimezone = evt.StartTimezone;
                entity.EndTimezone = evt.EndTimezone;


                entity.Fee = evt.Fee;
                entity.ContactName = evt.ContactName;
                entity.ContactPhone = evt.ContactPhone;
                entity.ContactEmail = evt.ContactEmail;
                entity.Summary = evt.Summary;
                entity.OffsiteLocation = evt.OffsiteLocation;
                entity.SubmitterName = evt.SubmitterName;
                entity.SubmitterPhone = evt.SubmitterPhone;
                entity.SubmitterEmail = evt.SubmitterEmail;
                entity.SubmitterComments = evt.SubmitterComments;
                entity.ImagePath = evt.ImagePath;
                entity.ImageAltText = evt.ImageAltText;

                entity.LastModified = evt.LastModified;
                entity.LastModifiedBy = evt.LastModifiedBy;

                entity.IsOffCampus = evt.IsOffCampus;
                entity.IsPublished = evt.IsPublished;
                entity.IsDisplayedOnNSCC = evt.IsDisplayedOnNSCC;
                entity.IsDisplayedOnConnectStudent = evt.IsDisplayedOnConnectStudent;
                entity.IsDisplayedOnConnectEmployee = evt.IsDisplayedOnConnectEmployee;
                entity.IsCollegeWide = evt.IsCollegeWide;


                foreach (var category in entity.Categories.ToList())
                {
                    entity.Categories.Remove(category);
                }

                foreach (var location in entity.Locations.ToList())
                {
                    entity.Locations.Remove(location);
                }

                if (evt.Categories != null)
                {
                    foreach (var categoryId in evt.Categories)
                    {
                        var category = db.Categories.FirstOrDefault(s => s.CategoryID == categoryId);
                        if (category != null)
                        {
                            entity.Categories.Add(category);
                        }
                    }
                }

                if (evt.Locations != null)
                {
                    foreach (var locationId in evt.Locations)
                    {
                        var location = db.Locations.FirstOrDefault(s => s.LocationID == locationId);
                        if (location != null)
                        {
                            entity.Locations.Add(location);
                        }
                    }
                }

                try
                {
                    db.SaveChanges();
                }

                catch (Exception)
                {
                    throw;
                }
            }
        }

 

How can I write my Delete function to remove recurring events that have recurrence exceptions? 

 

Thanks.

 

 

Veselin Tsvetanov
Telerik team
 answered on 26 Jan 2018
4 answers
1.0K+ views

Hi, Im trying to build a table that has 2 datetimes on it.

My problem is just that, on the method UpdateContainer, the instance container has the default date and never get updated .

Here is my front code:

@(Html.Kendo().Grid<WebPruebaTelerik1.Models.Container>()
                            .Name("ContainersStorage")
                            .Columns(columns =>
                            {
                                columns.Bound(p => p.Id).Title("ID").Width(150).Locked(true);
                                columns.Bound(p => p.Number).Title("Número").Width(150);
                                columns.Bound(p => p.Source).Title("Origen").Width(150);
                                columns.Bound(p => p.Type).Title("Tipo").Width(150);
                                columns.Bound(p => p.Material).Title("Material").Width(150);
                                columns.Bound(p => p.Gas).Title("Gas").Width(150);
                                columns.Bound(p => p.ConstructionDate).Title("Fecha de Fabricación").Format("{0: yyyy-MM-dd HH:mm:ss}").Width(250);
                                columns.Bound(p => p.InspectionDate).Title("Fecha de Inspección").Format("{0: yyyy-MM-dd HH:mm:ss}").Width(250);
                                columns.Bound(p => p.ACEP).Title("ACEP").Width(150);
                                columns.Bound(p => p.Tara).Title("Tara").Width(150);
                                columns.Bound(p => p.MGW).Title("MGW").Width(150);
                                columns.Bound(p => p.Trust).Title("Confianza").Width(150);
                                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(150);
                            })
                            .ToolBar(toolbar => toolbar.Create())
                            .Resizable(resizable => resizable.Columns(true))
                            .Scrollable(scrollable => scrollable.Height(540))
                            .Editable(editable => editable.Mode(GridEditMode.InLine))
                            .Pageable()
                            .Sortable()
                            .HtmlAttributes(new { style = "height:550px;" })
                            .Filterable()
                            .Events(events => events.Save("saveContainers"))
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .PageSize(10)
                                .Read("ListContainer", "Home")
                                .Model(model => model.Id(p => p.Id))
                                .Update("UpdateContainer", "Home")
                                .Create("CreateContainer", "Home")
                                .Destroy("DeleteContainer", "Home")
                            )
    )

 

Here is my controller code :

public class HomeController : Controller
{
        [HttpPost]
        public ActionResult UpdateContainer([DataSourceRequest] DataSourceRequest request, Container container)
        {
            dao.EditContainer(container); //Here has a breakpoint
            
            return Json(new[] { container }.ToDataSourceResult(request, ModelState));
        }
}
public class Container
    {
        public int Id { get; set; }
        public int Number { get; set; }
        public int Source { get; set; }
        public int Type { get; set; }
        public int Material { get; set; }
        public int Gas { get; set; }
        [DataType(DataType.DateTime)]
        public DateTime ConstructionDate { get; set; } = new DateTime(1970, 1, 1);
        [DataType(DataType.DateTime)]
        public DateTime InspectionDate { get; set; } = new DateTime(1970, 1, 1);
        public string ACEP { get; set; } = "";
        public float Tara { get; set; }
        public float MGW { get; set; }
        public int Trust { get; set; }
    }
Ruben
Top achievements
Rank 1
 answered on 26 Jan 2018
3 answers
743 views
I have two grids on a page (MVC Razor view) and i need them to scroll simultaneously (vertical scroll).  So if I scroll grid2 the grid1 scrolls for the same amount and vice versa. 
I fail to find event for scrolling in .Events of the grid, so I assume there is none.
Maybe there is workaround for this problem.
Please respond even if there is no solution for this problem.

Viktor Tachev
Telerik team
 answered on 26 Jan 2018
1 answer
249 views

Hi Team,

I am facing problem in cancelling the grid with Inline Edit. Currently I have a grid that displays ApplicationName and AccessLevelvalues when we click edit and update this grid is working fine. But When I click edit and cancel it, my name field for any other rows will be getting replaced with ApplicationName of first row.. My code snippet is

<div style="position:relative;">
    <div style="float:left;position:relative; width:200px;">
        <label>UserName:</label>
        @(Html.Kendo().DropDownList()
                        .Name("Users")
                        .DataTextField("FullNameLastFirstMiddle")
                        .DataValueField("UserGuid")
                        .DataSource(source =>
                        {
                            source.Read(read =>
                            {
                                read.Action("GetUsers", "User");
                            });
                        })

        //.Events(e => e.Select("Dummy"))
        .Events(e => e.Change("OnUserChange"))
        .SelectedIndex(0)

        )
    </div>
    <div style="float:left;width:100%; position:relative;padding:10px;">
        @(Html.Kendo().Grid<MODEL>()
      .Name("grid")
      .AutoBind(false)
      .Scrollable(sc => sc.Height(250))
      .Columns(columns =>
      {

          columns.Bound(a => a.UserGuid).Hidden();
          columns.Bound(a => a.ApplicationName);

          columns.Bound(a => a.AccessLevelName).EditorTemplateName("AccessLevelList");
          /////

          columns.Command(commands => { commands.Edit(); }).Width(100);
      })
         .Editable(editable => editable.Mode(GridEditMode.InLine)) // Use inline editing mode.
         .HtmlAttributes(new { style = "height:400px;" })

         .DataSource(ds => ds
            .Ajax()
            .PageSize(10)
            .ServerOperation(false)

            .Read(read => read.Action("GetApplicationGrid", "User").Data("ApplicationAccessData"))
            .Model(model =>
            {
                model.Id(app => app.UserGuid);

                model.Field(app => app.ApplicationName).Editable(false);
                model.Field(app => app.AccessLevelGuid).Editable(false);
                // Make the application name property not editable.
            })
                .Events(events => events.Sync("KendoGridfresh"))
            .Update(update => update.Action("UpdateAccess", "User")

            )
            )

        )
    </div>
</div>

<script>
    var appItem;
    function KendoGridfresh() {
        var grid = $("#grid").data("kendoGrid");
        grid.dataSource.read();

    }

    function OnUserChange(e) {
        appItem = this.value();
        var grid = $("#grid").data("kendoGrid");
        grid.dataSource.read();
        grid.refresh();
    }
    function ApplicationAccessData(e) {
        var item = appItem
        return { item: item }
    }
</script>

 

Raghu
Top achievements
Rank 1
 answered on 25 Jan 2018
3 answers
551 views

Hi,

I am using a treeview to load data and on edit of a row, i would want to display a dropwon to choose data, i tried below to get the dropdown, but this does not give me a dropdown, please advise if this is possible or how to achieve this.

columns.Add().Field(e => e.InActive).Editor("StatusType").Width(100) ;

below is a partial view i added under the EditorTemplate folder

@model CodedValues
@(Html.Kendo().DropDownListFor(m => m)
        .AutoBind(true)
        .DataTextField("DisplayText")
        .DataValueField("KeyText")
        .DataSource(dataSource =>
        {
            dataSource.Read(read => read.Action("GetTypes", "my"))
                    .ServerFiltering(true);
        })
)
@Html.ValidationMessageFor(m => m)

 

Thanks in advance.

Konstantin Dikov
Telerik team
 answered on 25 Jan 2018
8 answers
1.0K+ views

Assembly Reference "...\lib\KENDOUIMVC\2017.2.504.545\Kendo.Mvc.dll" was not updated properly. This usually happens when an assembly exists both in the GAC and in a local folder. Please, use the GAC reference instead.

 

How do I only use the GAC? And what is the GAC ;)

 

Maurice

Nikola
Telerik team
 answered on 25 Jan 2018
5 answers
206 views
Hello Team,

I am not able to close the event popup after I successfully create an event from KendoUI Scheduler.
Below is the error which I am able to see in firebug :

TypeError: e is undefined

Please guide... how to resolve this.
Ianko
Telerik team
 answered on 25 Jan 2018
1 answer
1.1K+ views
We need the Selectable option because it says without it the allowCopy() option will no longer work. We want it so that people can select a column with the checkbox and use the allowCopy functionality. The problem is that when the column select is on and Selectable is on when we check a row with the checkbox none of the checkboxes work.
Viktor Tachev
Telerik team
 answered on 25 Jan 2018
4 answers
1.2K+ views

I am trying to use the events(e => e.Error("onError") in my grid that is ajax bound.  I keep getting a javascript error "onError" is undefined.  the grid is on a partial page that is loaded via ajax call. 

when I put the script in the main view the onError function runs event if there is no error thrown.  if I put it in a document ready function  I get undefined.

not sure what to do.

index view

@model Jlo4MVC.Models.UserToSend
 
@{
    ViewBag.Title = "JLO";
}
 
<div id="userinput" class="row">
    <ul class="userrentry">
        <li>
            @Html.Label("User ID")
            @Html.Kendo().TextBox().Name("searchuserid")
        </li>
        <li>
            @Html.Kendo().Button().Name("findUser").Content("Search for Sessions").HtmlAttributes(new { @class = "k-button" })
        </li>
    </ul>
</div>
<div id="sessionsfound" class="row grid-centered" style="display:none">
 
</div>
<div id="status" class="row grid-centered" style="display:none">
</div>
<script type="text/javascript">
 
    $(document).ready(function(){
        function onError(e) {
            alert("Some Error");
        }
    })
 
    $('#findUser').click(function () {
        var myurl = '@Url.Action("getSessionsView", "home")';
        var model = { userID: $("#searchuserid").val() };
        $('#userinput').css("display", "none");
        $('#sessionsfound').css("display", "block");
        $.ajax({
            url: myurl,
            type: "POST",
            datatype: "html",
            data: model,
            success: function (data) {
                $('#sessionsfound').html(data);
            }
        });
 
    });
</script>

 

Partial view

@model Jlo4MVC.Models.UserToSend
 
 
<div>
    @(Html.Kendo().Grid<Jlo4MVC.Models.SessiondataDTO>()
        .Name("VSM_Grid")
        .NoRecords("NO Sessions Found")
        .Columns(c =>
            {
                c.Template(t => { }).ClientTemplate("<input type='checkbox' class='checkbox' />");
                c.Bound(i => i.id).Title("ID").Width(10);
                c.Bound(i => i.farmName).Title("Farm").Width(25);
                c.Bound(i => i.domainName).Title("Domain").Width(25);
                c.Bound(i => i.applicationName).Title("App Name").Width(75);
                c.Bound(i => i.serverName).Title("Server").Width(25);
                c.Bound(i => i.sessionID).Title("Session ID").Width(10);
                c.Bound(i => i.userID).Title("User ID").Width(40);
            })       
         
        .DataSource(data => data       
        .Ajax()
        .Events(events => events.Error("onError"))
        .Model(m => m.Id(p=>p.id))      
        .Read(read => read.Action("sessionsread", "Home", new {userID = Model.userID})))
        
    )
 
 
</div>
 
<div id="imentry" class="userrentry-gridsession">
    <label for="tbIMnumber" class="required">Incident Number</label>
    <input type="text" id="imnum" name="tbIMnumber" class="k-textbox" placeholder="Incident num" required validationmessage="Enter a valid Incident ID" style="width: 220px;" />   
</div>
<div class="kbutton-centered">  
    @Html.Kendo().Button().Name("endselected").Content("End Sessions").HtmlAttributes(new { @class = "k-button" })
</div>
<div id="showErrors" style="display:none">
 
</div>
<script>
 
   
    var checkedvalues = [];
    var jsonObj = [];
 
    $(function () {
        var validator = $("#imentry").kendoValidator().data("kendoValidator");
        var myurl = '@Url.Action("SessionsEnded", "home")';
 
        $("#endselected").click(function () {
            if (validator.validate()) {
                var imnum = $('#imnum').val();
 
                var datatosend = {
                    imnumber: imnum,
                    sessionDTO: jsonObj
                };
 
                $('#sessionsfound').css("display", "none");
                $('#status').css("display", "block");
                $.ajax({
                    url: myurl,
                    type: "POST",
                    datatype: "html",
                    data: datatosend,
                    success: function (data) {
                        $('#status').html(data);
                    }
                });
 
 
            }
 
        });
 
 
        var grid = $("#VSM_Grid").getKendoGrid();
        grid.table.on("click", ".checkbox", selectRow);
 
 
    })
 
    
 
    function selectRow() {
        var checked = this.checked,
            row = $(this).closest("tr"),
            grid = $("#VSM_Grid").data("kendoGrid"),
            dataItem = grid.dataItem(row);
        jsonObj.push(dataItem);
 
 
 
        //checkedvalues[dataItem.userID] = checked;
        if (checked) {
            //-select the row
            row.addClass("k-state-selected");
        } else {
            //-remove selection
            row.removeClass("k-state-selected");
        }
 
    }
 
 
     
 
</script>

 

public class HomeController : Controller
   {
       [HttpGet]
       public ActionResult JLO()
       {
           UserToSend usertoSend = new UserToSend();
           return View(usertoSend);
       }
 
 
       public ActionResult sessionsread([DataSourceRequest] DataSourceRequest request, UserToSend usertosend)
       {
 
           List<SessiondataDTO> sdto = new List<SessiondataDTO>();
           sdto.Add(new SessiondataDTO { applicationName = "testapplication", farmName = "testFarm", domainName = "MS", id = 1, serverName = "server01", userID = usertosend.userID, sessionID = 01 });
           sdto.Add(new SessiondataDTO { applicationName = "testapplication4", farmName = "testFarm", domainName = "MS", id = 2, serverName = "server02", userID = usertosend.userID, sessionID = 18 });
           sdto.Add(new SessiondataDTO { applicationName = "testapplication3", farmName = "testFarm", domainName = "MS", id = 3, serverName = "server12", userID = usertosend.userID, sessionID = 15 });
           sdto.Add(new SessiondataDTO { applicationName = "testapplication7", farmName = "testFarm", domainName = "MS", id = 4, serverName = "server00", userID = usertosend.userID, sessionID = 8 });
 
           //List<SessionData> sessiondatas = new List<SessionData>();
           //FarmInterfaceserviceClient svc = new FarmInterfaceserviceClient();
 
           //SessiondataDTO sessiondatadto = new SessiondataDTO();
 
           //List<SessiondataDTO> sdto = sessiondatadto.sessiondataTOSessionDTO(svc.GetSessionData(usertosend.userID));
 
           DataSourceResult result = sdto.ToDataSourceResult(request);
 
           return Json(result, JsonRequestBehavior.AllowGet);
       }
 
      [HttpPost]
       public ActionResult getSessionsView(UserToSend usertosend)
       {
 
           return PartialView("_GetSessionsView", usertosend);
       }
J
Top achievements
Rank 1
 answered on 24 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
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?