This question is locked. New answers and comments are not allowed.

Brian Mains
Top achievements
Rank 1
Brian Mains
asked on 12 Apr 2010, 10:31 PM
Hello,
Upgraded to latest telerik, a grid is now throwing this error:
column.Add((im) =>
{
%>
<%= Html.ActionLink("Select", "Get", new { controller = "Data", message = key }, new { @Class = "SelectLink" })%>
<%
});
column.Add(im => im.Subject);
.
.
All use the add method, not the bound method. I have paging as in:
.Pageable(page =>
{
page.PageSize(Model.PageSize);
page.Position(Telerik.Web.Mvc.UI.GridPagerPosition.Both);
page.Style(GridPagerStyles.NextPrevious);
})
And I get the error. What do I need to modify to get it to work?
Upgraded to latest telerik, a grid is now throwing this error:
Bound columns require a field or property access expression.
The grid has a templated column, along with 4 standard columns.column.Add((im) =>
{
%>
<%= Html.ActionLink("Select", "Get", new { controller = "Data", message = key }, new { @Class = "SelectLink" })%>
<%
});
column.Add(im => im.Subject);
.
.
All use the add method, not the bound method. I have paging as in:
.Pageable(page =>
{
page.PageSize(Model.PageSize);
page.Position(Telerik.Web.Mvc.UI.GridPagerPosition.Both);
page.Style(GridPagerStyles.NextPrevious);
})
And I get the error. What do I need to modify to get it to work?
4 Answers, 1 is accepted
0
Hello Brian Mains,
Check for bound columns which are not defined using member access expressions:
e.g.
columns.Add(c => c.CustomerID.ToString())
Then replace them with
columns.Bound(c => c.CustomerID).Template(c =>
{
%>
<%= c.CustomerID.ToString() %>
<%
});
By the way your code does not seem complete. Paste the whole grid declaration so we can help you with the upgrade.
All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Check for bound columns which are not defined using member access expressions:
e.g.
columns.Add(c => c.CustomerID.ToString())
Then replace them with
columns.Bound(c => c.CustomerID).Template(c =>
{
%>
<%= c.CustomerID.ToString() %>
<%
});
By the way your code does not seem complete. Paste the whole grid declaration so we can help you with the upgrade.
All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Brian Mains
Top achievements
Rank 1
answered on 13 Apr 2010, 02:34 PM
Hello,
I figured out what the error was; I assumed it was with the previous definition, but it wasn't. It was actually with this:
column.Add(im => im.GetName()).Title("Sent By");
column.Add(im => im.GetDate()).Title("Sent On");
This worked in the first version of the Telerik MVC framework, but not now. GetLastReplyName() is an extension method that drills through the bound object to get to the related field (a LINQ to Entities framework). I didn't want the drilling directly, as this uses a query. So I guess I have to use the template option and render directly now? I can no longer use Add?
Thanks.
I figured out what the error was; I assumed it was with the previous definition, but it wasn't. It was actually with this:
column.Add(im => im.GetName()).Title("Sent By");
column.Add(im => im.GetDate()).Title("Sent On");
This worked in the first version of the Telerik MVC framework, but not now. GetLastReplyName() is an extension method that drills through the bound object to get to the related field (a LINQ to Entities framework). I didn't want the drilling directly, as this uses a query. So I guess I have to use the template option and render directly now? I can no longer use Add?
Thanks.
0
Hello Brian Mains,
Yes. You could easily use a template column for this:
column.Template(im =>
%>
<%= im.GetName() %>
<%
).Title("Sent By");
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Yes. You could easily use a template column for this:
column.Template(im =>
%>
<%= im.GetName() %>
<%
).Title("Sent By");
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

John
Top achievements
Rank 1
answered on 23 Apr 2013, 06:15 PM
I am encountering the same issue but not able to implement the solution. I have an extension method to convert a julian date to a .Net DateTime.
My controller lookis like this:
And my View looks like this:
I am trying to use my extension here:
columns.Bound(p => p.DateInvoiceJulian.JdeToDate());
I am getting the "Bound columns require a field or property access expression" error
2 questions:
1. Is this the right place to do it or is there a way to do it on my linq? If there is i have no idea how.
2. If this is the right place, how do i do it?
Thanks
Patrick
public static DateTime JdeToDate(this int? jdeDate)
{
DateTime convertedDate;
short yearValue = (short)(Convert.ToDouble(jdeDate) / 1000d + 1900d);
short dayValue = (short)((Convert.ToDouble(jdeDate) % 1000) - 1);
convertedDate = new DateTime(yearValue, 1, 1).AddDays(dayValue);
return convertedDate;
}
My controller lookis like this:
public ActionResult Invoice()
{
return View(GetInvoices());
}
public ActionResult Invoice_Read([DataSourceRequest] DataSourceRequest request)
{
return Json(GetInvoices().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
private static IQueryable<
CustomerLedger
> GetInvoices()
{
WSDBContext context = new WSDBContext();
IQueryable<
CustomerLedger
> iQueryable = (from cl in context.CustomerLedgers
where cl.AddressNumberParent == 11409581
select cl);
return iQueryable;
}
And my View looks like this:
@model IEnumerable<WS.Framework.Data.CustomerLedger>
@
using
WS.Framework.Extensions;
@{
ViewBag.Title =
"Invoice"
;
//Layout = null;
}
<h2>Invoice</h2>
@Styles.Render(
"~/Content/kendo/2013.1.319/css"
)
@Scripts.Render(
"~/bundles/jquery"
)
@Scripts.Render(
"~/bundles/kendo"
)
@(Html.Kendo().Grid(Model)
.Name(
"Grid"
)
.Columns(columns =>
{
columns.Bound(p => p.SupplierInvoiceNumber);
columns.Bound(p => p.DateInvoiceJulian.JdeToDate());
columns.Bound(p => p.DateofLastSentReminder.JdeToDate());
columns.Bound(p => p.AmountOpen);
columns.Bound(p => p.Reference);
columns.Bound(p => p.PurchaseOrder);
})
.Groupable()
//.Pageable(pager => pager.PageSize(20, new int[] {25, 50, 100, 200}))
.Pageable()
.Sortable()
.Scrollable(s => s.Height(
"auto"
))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action(
"Invoice_Read"
,
"InvoicePrint"
))
)
)
I am trying to use my extension here:
columns.Bound(p => p.DateInvoiceJulian.JdeToDate());
I am getting the "Bound columns require a field or property access expression" error
2 questions:
1. Is this the right place to do it or is there a way to do it on my linq? If there is i have no idea how.
2. If this is the right place, how do i do it?
Thanks
Patrick