RadGridView disabling add/delete/edit rows

4 posts, 1 answers
  1. dalexsoto
    dalexsoto avatar
    7 posts
    Member since:
    Jul 2009

    Posted 18 May 2011 Link to this post

    Hi im using entity framework to bind the datasource of a RadGridView

    private void cmbUsers_SelectedValueChanged(object sender, EventArgs e)
               cmbUsers.ValueMember = "Id";
               var resguardos = from e1 in context.tblBienes
                                            where e1.IdResponsable == (long)cmbUsuarios.SelectedValue
                                            select new
                                                Id = e1.IdBien,
                                                Descripcion = e1.descripcion,
                                                Estado = e1.estado,
                                                Placa_Anterior = e1.placaAnterior,
                                                Placa_Nueva = e1.placaNueva,
                                                Ubicacion = e1.ubicacion,
                                                Fecha_De_Asignacion = e1.fechaAsignacion,
                                                Etiqueta = e1.etiqueta,
                                                Procuraduria = context.tblProcuradurias.Where(e2 => (e2.IdProcuraduria == (long)cmbProcuradurias.SelectedValue)).Select((e2 => e2.ciudad)).FirstOrDefault()
               rgvResguardos.DataSource = resguardos;

    rgvResguardos its a DataGridView and the result of the linq to entities its being given as datasource to it. i enabled Ading and enabled Editing on rgvResguardos but when i run my app it displays data but it doesnt allow me to add new rows nor editing or deleteing.

    is there any way to enable this options? i know i have to take care of inserting, deleteing and updating info on the database.
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 20 May 2011 Link to this post


    This happens because you are using Anonymous types, please create a concrete type and it will work as expected, and if possible create a BindingList<T> and bind that to the grid (for INotifyPropertyChanged).

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  3. Hannah
    Hannah avatar
    37 posts
    Member since:
    May 2013

    Posted 17 May 2013 Link to this post

    Can we force the Add Row to display and handle it ourselves in some manner while still using the dynamic or object datatypes as our datasource?

    CORRECTION: Nevermind, I had the ReadOnly flag set.  *facepalm*  It appears that dynamic datatypes still allow editing...as far as I can tell so far...
  4. Peter
    Peter avatar
    1160 posts

    Posted 22 May 2013 Link to this post

    Hello Wayne,

    I am happy that you found a solution for this. Should you have any other questions, do not hesitate to ask.

    RadChart for WinForms is obsolete. Now what?
Back to Top