Grid editor

2 posts, 0 answers
  1. Victor
    Victor avatar
    24 posts
    Member since:
    Feb 2015

    Posted 12 May 2015 Link to this post

    I have a grid that has joined tables from a doamin method entity.

    I want to edit the grid columns. for some reason, I keep getting a null value for some of the grid colunms.

    public ActionResult EditSubscriber([DataSourceRequest] DataSourceRequest gridRequest, Sub editSub, Subs editSubs)
            {
                if (ModelState.IsValid) 
                {

                   // Passin values
                    Sub subToUpdate = db.Subss.FirstOrDefault(s => s.Sub_ID == editSub.Sub_ID);                
                   subToUpdate .SFirstName = editSub.SFirstName;
                   subToUpdate .SLastName = editSub.SLastName;
                   subToUpdate .SEmail = editSub.SEmail;

                   // Null values. Values are not being passed. Why?

                    Subs subsToUpdate = db.Subsss.FirstOrDefault(s => s.Subs_ID == editSubs.Subs_ID);
                   subsToUpdate .SubsStartDate = editSubs.SubsStartDate;
                   subsToUpdate .SubsEndDate = editSubs.SubsEndDate;
                   subsToUpdate .SubsStatus = editSubs.SubsStatus;
                   subsToUpdate .SubsType_ID = editSubs.SubsType_ID;
                    
                    db.SaveChanges();
                }

                return Json(new[] { editSub}.ToDataSourceResult(gridRequest, ModelState));
            }

     

    Any idea?

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 14 May 2015 Link to this post

    Hello Victor,

    From the provided code sample we cannot tell what exactly is wrong. Do you have custom editors defined? Is it possible to isolate a runnable sample that we can run locally?

    Regards,
    Kiril Nikolov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top