OK, I prepared to accept that I'm doing this wrong but...
I have a grid that includes the following column definition ...
<telerik:GridBoundColumn |
HeaderText="Name" |
SortExpression="Name" |
UniqueName="Name"> |
</telerik:GridBoundColumn> |
My code behind reads something like this ...
var l = from contact in contacts |
select new |
{ |
ContactID = contact.ContactID, |
Name = contact.LastName + ", " + contact.FirstName, |
}; |
gdContacts.MasterTableView.DataSource = l; |
When I run this, rather than a value of "Hemming, Stuart" the "Name" column contains a ".ToString()"-like value that reads "{ContactID=1, Name="Hemming, Stuart"}.
Things work as expected if I change my column definition to a template column like this...
<telerik:GridTemplateColumn |
HeaderText="Name" |
SortExpression="Name" |
UniqueName="Name"> |
<ItemTemplate> |
<asp:Label runat="server" ID="lblName" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>' /> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
So, why is that?
Enquiring minds, and all that.
--
Stuart