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.

Dynamic Object .NET -


i facing interesting problem right now. know not pretty have cope anyway.

i calling webservice returns (array of string) (by index)
0 - table name ("employees")
1 - list of fields returned ("id, name, birthdate")
2 - first field value ("1")
3 - second field value ("bobby")
4 - third field value ("1970-01-01")

what accomplish create object name after index 0, having strings in index 1 being properties , feed them proper value.

what best way accomplish this? have started reading expandoobject before going far hear take on this.

regards

edit: have quite few different tables fetch data from, causing me problem.

it depends on use-case doubt dynamic way go here. have name-value collection so:

class result {     dictionary<string, string> values = new dictionary<string, string>();     public string this[string name] {         {             return this.values[name];         }         set {             this.values[name] = value;         }     }      // details } 

then can populate values webservice , query values saying

result result = populateresultfromwebservice(); string id = result["id"]; 

etc. if knew types make indexer of type object instead , parse values appropriate type , store them typed objects.

the issue dynamic if names of fields unknown, how possibly going write code utilizes fields?

edit: have quite few different tables fetch data from, causing me problem.

dude, name-value collection day every day.


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 -