none
Edit a datarowview RRS feed

  • Question

  • I am trying to set the value of my datarowview column "Count" but get the error msg: Column 'Count' is read only.

        foreach (DataRowView drv in dv)
        {
            instatement += drv[4].ToString() + ", ";

            dvProvidersByType.RowFilter = "ProviderNo = " + drv[4].ToString();

            int recs = int.Parse(dvProvidersByType[0][3].ToString());
            recs += dvProvidersByType.Count;

            dvProvidersByType[0].BeginEdit();

            dvProvidersByType[0][3]= recs;   // 3= Count

            dvProvidersByType[0].EndEdit();

        }


    M~
    Monday, October 3, 2011 5:54 PM

Answers

  • Make sure "Count" isn't set to ReadOnly = True:

    dvProvidersByType[3].ReadOnly = False;
    

    Also, make sure your underlying object that the gridview is using as the DataSource is an updateable object, and make sure on that object that the "Count" property is a writeable property (has as setter). 

     

     


    Tom Overton
    • Marked as answer by WIJ Monday, October 3, 2011 7:32 PM
    Monday, October 3, 2011 6:22 PM