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

RadGrid CardView

1 Answer 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Whritenour
Top achievements
Rank 1
David Whritenour asked on 18 Aug 2010, 05:24 PM
Hello,

I noticed that the RadGrid CardView demo (http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/cardview/defaultcs.aspx) the <Columns> and <telerik:GridBoundColumn> tags are no longer present once the <ItemTemplate> tag is used.

However, in the documentation for the RadGrid CardView (http://www.telerik.com/help/aspnet-ajax/grdcardview.html) <Columns> tag is used.  What is the reason for this?

In my own CardView project, when I remove the <Columns> tag (and child <telerik:GridBoundColumn> tags), my data within the <ItemTemplate> tag no longer appears.  What could be causing this?

Thanks,
David

1 Answer, 1 is accepted

Sort by
0
Accepted
Schlurk
Top achievements
Rank 2
answered on 18 Aug 2010, 05:45 PM
The reason for this is that in that demo the ItemTemplate is defined for all items, not just a singular item. With this approach you are essentially saying that every single item will follow the same template, and if you would want to add a <columns> tag within this you would actually have to first define a new RadGrid within the template. If you are simply looking to have a few regular columns and template a single (or a couple) columns just define the columns collection and then have <telerik:GridTemplateColumn>s instead.

As for that documentation article I think this might actually be an older way of defining things where an initial column had to be used in order to have a proper item template, but I could be wrong about that. Either way the general rule of thumb that I follow is that if I need a common template for all of my rows I don't even bother defining a column collection, and if I just want to template a few columns I just use GridTemplateColumns.
Tags
Grid
Asked by
David Whritenour
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or