RadGrid CardView

2 posts, 1 answers
  1. David Whritenour
    David Whritenour avatar
    6 posts
    Member since:
    Nov 2009

    Posted 18 Aug 2010 Link to this post


    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?

  2. Answer
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 18 Aug 2010 Link to this post

    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.
Back to Top