Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

vb.net - Why isn't this Linq query on Dictionary<TKey, TValue> working as DataSource -


i have following in vb:

dim sources = source in importsources select new _     {.type = source.key, .source = source.value.name}  dgridsourcefiles.datasource = sources 

when debug, sources shows in-memory query , has 2 records within. yet datagrid view not show records.

so why won't work? suggestions can either vb or c#...

update

when use:

dim sources = (from source in importsources select new _     {.type = source.key, .source = source.value.name}).tolist() 

...the datasource displayed.

your linq query lazily evaluated , implements ienumerable<t> interface (as far know), means results not established until enumerator calls movenext somewhere (as happens within foreach loop, example).

it seems datasource property not enumerate contents in way. it's expecting implementation of ilist (or 1 of few other interfaces—see below) can access items index. used internally control sorting, filtering, etc. in mind, it's setting datasource property check object's type see whether implements of supported interfaces. don't think datasource property designed deal type of object (a lazily evaluated query) @ all.

now, tolist call populates list<t> results of query; does implement ilist , can therefore used datasource.

my understanding reason datasource typed merely object expects any of following interfaces:

this according msdn documentation.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -