I am trying to create filters like in eCommerce website like Amazon, Flipkart.
I have created primary tables for all filters as below.
create table Work
(
id int identity(1,1) Primary Key Not Null,
work_name varchar(30) Not Null,
isSelected bit Default(0),
created_date Datetime default(GETDATE())
)
Now I want to create a CheckBox List so that a user can filter the products according to the selected details.
I have created an Editor Template
@model API.Models.Work
@Html.HiddenFor(x=>x.id)
@Html.HiddenFor(x => x.work_name)
@Html.CheckBoxFor(x=>(bool)x.isSelected)
@Html.DisplayFor(x=>x.work_name)
I am using the template as
@model IEnumerable<API.Models.Work>
@Html.EditorForModel()
I get the below error
**An exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll but was not handled in user code
Additional information: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.**
How it can be done??