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.

c# - Where clause on linq query against dictionary? -


i have fixed problem of not listing data related wrong field on spawn dictionary still question if way approaching ok ?

i have few checkboxs if true should add check item status , include on list.

so not knowing do, came with:

        hashset<int> status = new hashset<int>();         if (optionsform.filterplayer.checked) status.add(0);         if (optionsform.filterenemy.checked) status.add(1);         if (optionsform.filtersummon.checked) status.add(2);         if (optionsform.filternpc.checked) status.add(3);         if (optionsform.filterobject.checked) status.add(4);         if (optionsform.filtermonster.checked) status.add(5);         if (optionsform.filtergatherable.checked) status.add(6);         if (optionsform.filterunk.checked) status.add(7);          var query = spawnlist item in spawnentities.values                     status.contains(item.status)                     orderby item.name ascending                     select item; 

but not returning me errors or items should have been returned.

spawnentities dictionary uint, spawnlist.

spawnlist simple class:

public class spawnlist {     public string name { get; set; }     public int status { get; set; }     // more data not needed question } 

it mistake, status on dictionary wrong in 1 field , not getting wanted after listing data noticed heh, ok doing ?

to avoid such mistakes, use enumerations instead of ints - define

enum somestatus {     player,     enemy,     <.etc.> } 

and change

public int status { get; set; } 

into

public somestatus status { get; set; } 

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 -