Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:59:29+00:00 2026-06-17T16:59:29+00:00

I have a kendo grid (inline mode) in my mvc project and I initialized

  • 0

I have a kendo grid (inline mode) in my mvc project and I initialized the grid all by mvc.
The problem is when I add a new row it gets a 0 id and it’s dirty property is set to true.
How can I refresh the added item and set the correct id to it?

This is my Kendo Grid:

@(Html.Kendo().Grid<IranHost.Tools.Services.Core.DataModel.Site>()
                                    .Name("grid")
                                    .Columns(columns =>
                                    {
                                        columns.Bound(p => p.Domain).Width(250).Title("دامین");
                                        columns.Command(command => { command.Edit().Text("ویرایش").UpdateText("ذخیره").CancelText("لغو"); command.Destroy().Text("حذف"); });
                                    })
                                    .ToolBar(toolbar => toolbar.Create().Text("افزودن دامین جدید").HtmlAttributes(new { @class = "add-button" }))
                                    .Editable(editable => { editable.Mode(GridEditMode.InLine); })
                                    .Sortable()
                                    .Pageable()
                                    .Scrollable()
                                    .Events(action => { action.Edit("gridEdit"); action.Save("gridSave"); action.SaveChanges("gridSaveChanges"); })
                                    .DataSource(dataSource => dataSource
                                        .Ajax()
                                        .Events(events => { events.Error("result_handler"); })
                                        .Model(model => model.Id(p => p.Id))
                                        .Create(create => create.Action("AddDomain", "Service", new { customerID = ViewBag.CustomerId }))
                                        .Read(read => read.Action("GetDomainListForGrid", "Service", new { customerID = ViewBag.CustomerId }))
                                        .Update(update => update.Action("EditDomain", "Service"))
                                        .Destroy(destroy => destroy.Action("DeleteDomain", "Service"))
                                    )
                                    )

And This is what I’ve done in the server side:

public ActionResult AddDomain([DataSourceRequest] DataSourceRequest request, DataModel.Site site)
    {
        if (ModelState.IsValid)
        {
            var pattern = "([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)";
            if (!Regex.IsMatch(site.Domain, pattern))
            {
                //TODO: Must be added in the framework.
                ModelState.AddModelError("ERROR", "Wrong URL Format!");
                return Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet);
            }

            var siteContext = new Biz.Site(DataContext);
            siteContext.Add(site);
            DataContext.SaveChanges();
            ModelState.AddModelError("ADDED", site.id);
            return Json(new[] { site }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
        }

        return new HttpStatusCodeResult(403);
    }

But still it doesn’t work!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:59:30+00:00Added an answer on June 17, 2026 at 4:59 pm

    Problem Solved!
    I was using older version of KendoUI and it didn’t have requestEnd so I started using AddModelError to handle server side results.
    Actually I used AddModelError not for error but just telling the client side that adding/editing the item was with success.

    It was actually a very bad idea but I didn’t have a choice at moment. In the client side I was raising Events.Error(“result_handler”). Kendo though that it really is an error so it didn’t made any changes on the ui but setting the dirty property to true!

    Now my boss is trying to get new version of KendoUI in the meanwile I’m using ajaxComplete to raise other events. Unfortunately I don’t really have much of a choice until I get the newer version!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Kendo Grid I have the default Add a new Record button and
I have have got a MVC 3 Project where I use a Kendo UI
I have a kendo grid in mvc with column property .Encoded(false) In the controller
I have a kendoUI grid. @(Html.Kendo().Grid<EntityVM>() .Name(EntitesGrid) .HtmlAttributes(new { style = height:750px;width:100%;scrollbar-face-color: #eff7fc; })
I am having trouble starting with kendo grid with asp.net mvc 4. I have
In an MVC project i have the following view where i use the Kendo
I am using the Telerik Kendo grid with MVC and C#. I have a
I have used Kendo grid, I need to select a row without command columns.
I have a Kendo Grid for MVC and I have added a custom command
I have implemented inline editing with Knedo UI MVC grid with Ajax binding, Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.