var grid = new WebGrid(Model, rowsPerPage: 10, canPage: true, canSort: true);
@grid.GetHtml(
columns: new[]
{
grid.Column("CompanyId",
style:"col7",
format:@<p>
<input type="text" id="HCompanyId" value="@item.CompanyId" />
</p>),
grid.Column("CompanyName",
style: "col1",
format:(@item)=>Html.TextBoxFor(item.CompanyName)),
grid.Column("CompanyUrl",
style: "col2",
format: @<text> <span id="companyurl" class="display-mode">@item.CompanyUrl</span>
<input type="text" id="txtUrl" value="@item.CompanyUrl" class="edit-mode"/>
</text>),
grid.Column("",header:"Actions",
style: "col4",
format:@<p>
<input type="button" id="btnEdit" value="Edit" class="editdisplay-mode" />
<input type="button" id="btnSave" value="Save" class="Saveedit-mode" />
</p>),
},
headerStyle: "webgridHeader",
tableStyle: "webgrid",
mode: WebGridPagerModes.All,
footerStyle: "webgridFooter",
htmlAttributes: new { id = "grdCompanies" })
CompanyName column of webgrid showing error "cannot convert lamdaexpression to sysstem.function dynamic object"
In this normal html controls are working fine but html helpers are not working.
I tried
grid.Column("CompanyName",style: "col1", format: (item)=> @<text>@Html.TextBoxFor("item", (String)item.CompanyName)
Can anyone spot what I am doing wrong?