We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Duplicate controls for Edit when InlineForm or Dialog

Thread ID:

Created:

Updated:

Platform:

Replies:

130153 Apr 25,2017 03:44 PM UTC Apr 26,2017 05:01 PM UTC ASP.NET MVC 2
loading
Tags: Grid
Mahir Palos
Asked On April 25, 2017 03:44 PM UTC

When using grid control for ASP.NET MVC 5 application and adjusting it as in demo provided, controls are duplicated for InlineForm or Dialog EditMode. Actually controls aren't duplicated but there are as many control sets there as records available. It seems as actual selection of record prior to editing has no effect whatsoever.

Here is relevant server side code:

        public ActionResult Edit()
        {
            ViewBag.dataSource = db.Parties.ToArray();
            return View();
        }

        public ActionResult InlineUpdate(Party value)
        {
            Party result = db.Parties.Where(o => o.Id == value.Id).FirstOrDefault();
            db.Entry(result).CurrentValues.SetValues(value);
            db.SaveChanges();
            return Json(db.Parties.ToArray(), JsonRequestBehavior.AllowGet);
        }

        public ActionResult InlineInsert(Party value)
        {
            db.Parties.Add(value);
            db.SaveChanges();
            return Json(db.Parties.ToArray(), JsonRequestBehavior.AllowGet);
        }

        public ActionResult InlineDelete(int key)
        {
            Party result = db.Parties.Where(o => o.Id == value.Id).FirstOrDefault();
            db.Parties.Remove(result);
            db.SaveChanges();
            return Json(db.Parties.ToArray(), JsonRequestBehavior.AllowGet);
        }

On a client side view is as follows:

@using Syncfusion.JavaScript.Models
@{
ViewBag.Title = "Parties";
}
<h2>Parties</h2>
<div id="ControlRegion">
@(Html.EJ().Grid<object>("Editing")
.Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).UpdateURL("InlineUpdate").InsertURL("InlineInsert").RemoveURL("InlineDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EnableAltRow()
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.InlineForm); })
.AllowPaging()
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
col.Field("Name").HeaderText("Name").Width(90).Add();
col.Field("Surname").HeaderText("Surname").Width(90).Add();
})
)
</div>

Finally, result with either inline form or dialog is that there is sets as many as records there:



As the message implies, it seems that record selection isn't properly reflected in javascript code. Version used is 15.1.0.33 and Sample Creator is used to devise solution.
Browser is Chrome 58.

Here is finally excerpt from final page source heading (if review of actual content/js is of some help):


    <link rel='nofollow' href="/Content/bootstrap.css" rel="stylesheet"/>
    <link rel='nofollow' href="/Content/site.css" rel="stylesheet"/>
    <link rel='nofollow' href="/Content/ej/web/Flat-Lime/ej.web.all.min.css" rel="stylesheet"/>
    <script src="/Scripts/modernizr-2.6.2.js"></script>
    <script src="/Scripts/jquery-3.1.1.min.js"></script>
    <script src="/Scripts/jsrender.min.js"></script>
    <script src="/Scripts/ej/ej.web.all.min.js"></script


Mahir Palos
Replied On April 25, 2017 04:11 PM UTC

This was fun. Only after 2 days struggling with it and after posting question here, found that it it necessary to have PrimaryKey column included on view. It must not be visible but after putting it there everything started to work just as usual.



Thavasianand Sankaranarayanan [Syncfusion]
Replied On April 26, 2017 05:01 PM UTC

Hi Mahir, 

We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  

Regards, 
Thavasianand S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;