datagridview column readonly only in edit mode

I have a Datagridview control that is bound to a table in an access database. The table has only two fields, Code and Description. The column Code is Readonly = true, but in the BindingNavigatorAddNewItem_Click I change this column to be readonly = false (because I need to be able to enter the data only when it is addition). I need to return this column to readonly = false at end of the addition process.



Answer this question

datagridview column readonly only in edit mode

  • gatsby0121

    I figure what's happening.

    Issue

    Cannot set the datagridview column property to readyonly = false at design time

    My Design

    Datagridview is link to a databindingsource, which is linked to a dataset, and the dataset is link to a store procedure.

    e.g.

    datagridview --> databindingsource --> dataset control(on the form) --> typed dataset(xsd) -- > store procedure

    Reson not work

    The reason is I create a dummy store procedure.

    Dummy store procedure

    select

    'ABC' as column1,

    'CDE' as column2

    Solution

    Don't use dummy store procedure, change the store procedure to a select form table

    e.g

    select

    column1,

    column2

    from

    mytable

    It fixed the issue... I am surprise that Visual Studio 2005 is very smart to capture this error. I used to trick the windows by writing dummy store procedure when develop.



  • SilverwingsTXN

    I have the same issue. I have set the column property readonly to false.

    When I save and open the column property, it is set to True. Now I am not able to edit the cells in the datagridview.

    I wonder is it a bug

    Do you have the solution

    Thanks.



  • datagridview column readonly only in edit mode