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.

asp.net mvc - model binding IList of custom object -


i have class contains:

public ilist<propertyvalueoperators> filterlist { get; set; } 

where propertyvalueoperators:

public class propertyvalueoperators     {         public string property { get; set; }         public string value { get; set; }         public string likeoperator { get; set; }     } 

i have typed view creates form based on class a. have read here:

asp.net mvc model binding ilist<> parameter

that model binding should able populate lists such filterlist have implemented html helper generates this:

<label for="items[0].property">filter by</label>     <select id="items[0]_property" name="items[0].property">     <option selected="selected" value="item.id">dbid</option>     <option value="category_itemname.name">name</option>     </select>     <label for="items[0].likeoperator">filter operator</label>     <select id="items[0]_likeoperator" name="items[0].likeoperator">     <option value="contains">contains</option>     <option value="endswith">ends with</option>     <option selected="selected" value="equals">equals</option>     <option value="starts with">starts with</option>     </select>     <label for="items[0].value">filter value</label>     <input name="items[0].value" style="width: 100px;" value="920058" id="items[0]_value" width="5" type="text">     <br>     <label for="items[1].property">filter by</label>     <select id="items[1]_property" name="items[1].property">     <option value="item.id">dbid</option>     <option selected="selected" value="category_itemname.name">name</option>     </select>     <label for="items[1].likeoperator">filter operator</label>     <select id="items[1]_likeoperator" name="items[1].likeoperator">     <option value="contains">contains</option>     <option value="endswith">ends with</option>     <option value="equals">equals</option>     <option selected="selected" value="starts with">starts with</option>     </select>     <label for="items[1].value">filter value</label>     <input name="items[1].value" style="width: 100px;" value="" id="items[1]_value" width="5" type="text"> 

unfortunately when post form, filterlist has count of 0. can see wrong? or impossible achieve want without implementing custom model binder?

thanks.

christian

please feel free vote deletion. solution replace items filterlist. that's it.

christian


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 -