Insert is an invalid operation ?

Insert is an invalid operation ?

Old forum URL: forums.lhotka.net/forums/t/9967.aspx


ddredstar posted on Thursday, January 20, 2011

There is a ReadOnly List, i want to bind this list to a dropdownlist, and insert a default item like bellow:

GeoList.GetAllGeo((s, o) =>
                {
                    if (o.Error == null)
                    {
                        Geos = o.Object;
                        Geos .Insert(0, new GeoInfo(0, "Please Select One"));
                    }

                });

Goes is a type of GeoList property in my ViewModel, whick as ItemsSource of my Dropdownlist

but a exception been thrown said: Insert is an invalid operation

please help me.

sergeyb replied on Thursday, January 20, 2011

You have to set IsReadOnly to false to do insers.  What you really want to do in this case is add this"fake" item on the server in DP_Fetch anyway,

ddredstar replied on Thursday, January 20, 2011

Yes, you are definitely right.

Thanks very much!

Copyright (c) Marimer LLC