ReadOnly DON'T WORK

2 posts, 0 answers
  1. accdefault
    accdefault avatar
    1 posts
    Member since:
    Dec 2019

    Posted 21 Mar Link to this post

     

     

                    _dr = parent.data.view.sys.village_request_res.Select("id_village = '" + village["id"].ToString() + "' ");
                    if (_dr.Length > 0)
                    {
                        dgVillageRequestRes.DataSource = _dr.CopyToDataTable();
                        dgVillageRequestRes.Columns["id_village"].IsVisible = false;
                        dgVillageRequestRes.Columns["name"].IsVisible = false;
                        dgVillageRequestRes.Columns["priority"].ReadOnly = false; //DON'T WORK
                    }
                    else { dgVillageOper.DataSource = null; }

     

    I cannot edit cells in the Columns["priority"] column. Help fix!

  2. Nadya
    Admin
    Nadya avatar
    344 posts

    Posted 23 Mar Link to this post

    Hello,

    Note that such a query will return a list of anonymous objects. These objects in the data table are read-only and this is why you can not edit them in the grid. You should change the value in the data source manually, execute the query again and rebind the grid.

    Please refer to the following msdn threads that might be quite useful on this topic:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/3f6e51c6-fe3f-48b2-88b7-835663fd31fb/datagridview-column-cant-be-changed-from-readonly-to-writable?forum=vbgeneral
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/d5527c78-9c97-4535-865f-07b50f68a888/how-to-make-datagridview-editable-when-binding-with-linq?forum=csharpgeneral

    I hope this information helps. Should you have other questions I will be glad to help.

    Regards,
    Nadya
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top