Exception:-A data source must be bound before this operation can be performed.
I am using webgrid to display data and i am using validation ,when my code (vcCtgCode) is null
it display above exception ,How to Overcome the exception.
@model IEnumerable<******.Model.tblMstCategory_CTG>
@{
var grid = new WebGrid(Model, ajaxUpdateContainerId: "inCtgId");
@grid.GetHtml(
tableStyle: "webgrid-table",
headerStyle: "webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
selectedRowStyle: "webgrid-selected-row",
rowStyle: "webgrid-row-style",
htmlAttributes: new { id = "Grid" },
//mode: WebGridPagerModes.All,
columns: new[]
{
grid.Column("inCtgId",header:"Id")
,grid.Column("vcCtgCode",header:"Code",format: (item)=> string.IsNullOrEmpty(item.vcCtgCode)?string.Empty:item.vcCtgCode)
})
}
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajeesh MenothPosted Oct 25, 2016, 7:28 AM
Sagar BandkarPosted Oct 25, 2016, 7:19 AM
Rajeesh MenothPosted Oct 25, 2016, 6:48 AM