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.

Initializing objected created in .NET CollectionEditor with a specific reference -


i need initialize new objects created collectioneditor specific reference.

more specifically, have object, pipeline, can edited in propertygrid. object contains collection of markers. markers need reference pipeline in order calculations.

currently, propertygrid pipeline has entry markers. clicking on ellipse button brings collectioneditor. editing properties fine, need set current pipeline new markers created. i'm not sure of best way that. there events can monitor? need create custom collectioneditor (but how know specific pipeline?)?

you need create custom collectioneditor , custom propertydescriptor class. propertydescriptor can store pipeline object gets passed collection editor overriding propertydescriptor.geteditor. let pipeline create new markers objects , required initialization.

here code started:

public class mycollectioneditor : system.componentmodel.design.collectioneditor { private pipeline _pipeline;      public mycollectioneditor(type type) : base(type) {}      public mycollectioneditor(type type, pipeline pipeline) : base(type)     {       _pipeline = pipeline;     }      protected override object createinstance(type itemtype)     {       return _pipeline.createnewmarker();     } }  public class mypropertydescriptor : propertydescriptor { private pipeline _pipeline;  public mypropertydescriptor(pipeline pipeline) : base(name, null) {   _pipeline = pipeline; }  public override object geteditor(type editorbasetype) {   return new mycollectioneditor(typeof(markercollection), _pipeline); }  // ... other overrides ...  }  // ... // implement system.componentmodel.icustomtypedescriptor.getproperties  public system.componentmodel.propertydescriptorcollection getproperties() { propertydescriptorcollection pdc = new propertydescriptorcollection(null); foreach (marker m in markers) {     mypropertydescriptor pd = new mypropertydescriptor(m);     pdc.add(pd); } return pdc; } 

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 -