You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @cesarsouza. I've been working with the 1.3.4 version for .NET 3.1 and everything is going well. One question (which is not so much of an issue but an inquiry, not sure where to ask if not here!), is there an easy way to cast a DynamicList <DynamicListItem> to a ICollection, or do I have to loop over it every time? As far as I can tell there is not a function in place; but please correct me if I am wrong. The functions such as AsIEnumerable, AsQueryable don't do that exactly I think.
The text was updated successfully, but these errors were encountered:
Thanks for the question! Unfortunately it is not possible to cast the list directly to an ICollection because if the DynamicList implemented the ICollection interface, this would confuse the default ASP.NET model binder during binding. This was actually something that I had added in v1.4 but now removed when I last updated it to v1.5 because it was causing issues.
If you would like to convert the list to a collection, I think the easiest way would be to use .ViewModels or .Options properties of the DynamicList, e.g.:
DynamicList<BookViewModel>books=newDynamicList<BookViewModel>();varviewModels=books.ViewModel.ToList();// to get a list of the view models, orvarlistItems=books.Options.ToList();// to get a list of the dynamic list items
Hi @cesarsouza. I've been working with the 1.3.4 version for .NET 3.1 and everything is going well. One question (which is not so much of an issue but an inquiry, not sure where to ask if not here!), is there an easy way to cast a DynamicList <DynamicListItem> to a ICollection, or do I have to loop over it every time? As far as I can tell there is not a function in place; but please correct me if I am wrong. The functions such as AsIEnumerable, AsQueryable don't do that exactly I think.
The text was updated successfully, but these errors were encountered: