More in this section
Forums / Developing with Sitefinity / Event ItemList - adding a column

Event ItemList - adding a column

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 1 answered
  1. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    21 Mar 2011
    Link to this post
    Greetings,

    I have created a custom module in the Sitefinity CMS system, extending the existing Events module.  I've got all of my modifications to the add/edit templates working just fine, but when I try to add the Category MetaField into the EventsItemList.ascx template that I've copied, the data in that column always comes up with a value of "undefined", instead of the selected category.  I can access that particular MetaData just fine in the Add/Edit screens, and access it programatically when I pull the content into my site, but I can't figure out why that field isn't mapping correctly in the EventsItemList.ascx.  The relevant code is below.

    <telerik:ClientTemplatesHolder ID="GridTemplates" runat="server">
        <telerik:ClientTemplate Name="Edit" runat="server">
            <a href="<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).ItemEditUrl %>"><asp:Literal ID="Literal7" Text="<%$ Resources:Edit %>" runat="server" /></a>
        </telerik:ClientTemplate>
        <telerik:ClientTemplate Name="Delete" runat="server">
            <a href="javascript:if(confirm('<%= GetLocalResourceObject("AreYouSure_Delete") %>')) DeleteContent('{#ID#}')"><asp:Literal ID="Literal1" Text="<%$ Resources:Delete %>" runat="server" /></a>
        </telerik:ClientTemplate>
        <telerik:ClientTemplate Name="View" runat="server">
            <a href="<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).ItemViewUrl %>">{#MetaFields.Title#}</a>
        </telerik:ClientTemplate>
        <telerik:ClientTemplate Name="Title" runat="server">
            {#MetaFields.Title#}
        </telerik:ClientTemplate>
    <!-- Modified to add Category MetaField -->
        <telerik:ClientTemplate Name="Category" runat="server">
            {#MetaFields.Category#}
        </telerik:ClientTemplate>
        <telerik:ClientTemplate Name="Status" runat="server">
            {#Status#}
        </telerik:ClientTemplate>
    </telerik:ClientTemplatesHolder>
    <div id="gridPlaceholder">
    <telerik:RadGrid ID="ItemsGrid" runat="server" AutoGenerateColumns="false" AllowSorting="true" AllowPaging="true" PageSize="50" EnableViewState="false" Skin="SitefinityItems" EnableEmbeddedSkins="false" AllowMultiRowSelection="true">
        <MasterTableView AllowMultiColumnSorting="false" CssClass="listItems listItemsBindOnClient" Width="98%">
            <Columns>
                <telerik:GridTemplateColumn UniqueName="Edit" ItemStyle-CssClass="gridActions edit" />
                <telerik:GridTemplateColumn UniqueName="Delete" ItemStyle-CssClass="gridActions delete" />
                <telerik:GridClientSelectColumn UniqueName="CheckBoxColumn" HeaderStyle-CssClass="check" ItemStyle-CssClass="check">
                </telerik:GridClientSelectColumn>
                <telerik:GridTemplateColumn
                    UniqueName="View" 
                    SortExpression="Title"
                    ItemStyle-CssClass="gridContentTitle"
                    HeaderText="<%$ Resources:Title %>">
                </telerik:GridTemplateColumn>
    <!-- Modified to add Category MetaField -->
                <telerik:GridTemplateColumn
                    UniqueName="Category" 
                    HeaderText="Category">
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn
                    UniqueName="Status" 
                    HeaderText="<%$ Resources:Status %>">
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <PagerStyle Mode="NumericPages" />
        <ClientSettings>
            <ClientEvents OnCommand="RadGrid_Command" OnRowDataBound="RadGrid_RowDataBound" OnRowSelected="RadGrid_RowSelected" OnRowDeselected="RadGrid_RowDeselected" />
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
    </telerik:RadGrid>
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Mar 2011
    Link to this post
    Hello Phillip,

    Have you added the category metakey to DataBindGrid - requiredMetaFields variable?

    All the best,
    Ivan Dimitrov
    the Telerik team
    Answered
  3. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    21 Mar 2011
    Link to this post
    Ahh...that did the trick.   Thanks much Ivan!
Register for webinar
3 posts, 1 answered