This is a migrated thread and some comments may be shown as answers.

Strongly Typed

4 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hobeau
Top achievements
Rank 1
hobeau asked on 28 Jul 2014, 11:32 PM
Hey guys,

I've been following your documentation at:

http://www.telerik.com/help/aspnet-ajax/grid-model-binding-and-strongly-typed-data-controls-support.html

I'm trying to get the strongly typed binding to work. I am setting the ItemType to a publicly available object and I cannot seem to access Item object in my radgrid binding in the ItemTemplate. I've followed the examples to the tee and cannot get this to work. I've also tested this on the same page with a asp:GridView and it works great. I have the latest version of telerik AJAX controls (Q2 2014). I can't figure out what I'm doing wrong. Can anyone help?

4 Answers, 1 is accepted

Sort by
0
hobeau
Top achievements
Rank 1
answered on 30 Jul 2014, 02:23 PM
Anyone? Is no one else having this issue?
0
Konstantin Dikov
Telerik team
answered on 31 Jul 2014, 02:57 PM
Hello Richard,

Could you please confirm that you are using .NET 4.5 and that you are setting the correct ItemType property to both, RadGrid and MasterTableView.

For your convenience I have prepared a very simple example demonstrating how to use custom type and how to access the properties through the Item in the templates.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Steven
Top achievements
Rank 1
answered on 15 Oct 2014, 01:30 AM
I was having the problem where I had specified the on the Rad Grid element:   
ItemType="MyNamespace.ClassName"

But the ItemTemplate in the GridTemplateColumn was not picking up the specified type using the syntax:
<%# Item.PropertyName%>

This included intellisense not picking it up and also resulted in a compiler error.

The way to fix is to make sure you specify the Item type on the RadGrid Element and also the MasterTableView element.

The telerik documentation does not seem to show this anywhere.
0
Viktor Tachev
Telerik team
answered on 17 Oct 2014, 02:30 PM
Hello Steven,

Thank you for pointing to us that the information is not clear enough. I have updated the article and the change will be reflected after the next documentation update.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
hobeau
Top achievements
Rank 1
Answers by
hobeau
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Steven
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or