+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Add Columns to Admin Events Module

Add Columns to Admin Events Module

12 posts, 0 answered
  1. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    16 Nov 2009
    Link to this post
    Hello,

    I have a need to add columns to the Admin Events Module view page (Modules >> Events).  By default, it is showing the Title of the event and a Status (which is "Published" for all of them).  It is sortable by Title. 

    I'd like to show the event date on this page and have it sortable by that field as well.

    Please see the attached screen capture of the Events Module View page so you can see what I'm referring to.

    Is there a way to do this?

    Thanks,
    Chad
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 Nov 2009
    Link to this post
    Hi Chad,

    By default you should have all metakeys bound to "Search item by " DropDownList control. To add additional columns you need to follow the steps below:

    1. Map external template EventsItemsList.ascx
    2. Modify the template as shown below. Here I am using Publication_Date, but you can use each metafield you have:

    ....
      ....
        <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>
            <telerik:ClientTemplate Name="Title" runat="server">
                {#MetaFields.Publication_Date#}
            </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>
                    <telerik:GridTemplateColumn
                        UniqueName="Publication_Date" 
                        HeaderText="<%$ Resources:Publication_Date %>">
                    </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>
        </div>
        <asp:HiddenField ID="cultureInfoField" runat="server" />
         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
    <!--
    var dataProviderName = "<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).ProviderName %>";
    var gridTemplates = ClientTemplates.GetSet("<%= GridTemplates.ClientID %>");
    var allowDelete = "<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).AllowDelete %>";
    var allowModify = "<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).AllowModify %>";
    var groupOpsVisible = false;
     
    function loadData() {
        var tableView = $find('<%= ItemsGrid.ClientID %>').get_masterTableView();
        var currentPageIndex = tableView.get_currentPageIndex();
        var pageSize = tableView.get_pageSize();
        var filterExpressionField = document.getElementById('<%= FilterExpressionField.ClientID %>');
        DataBindGrid(currentPageIndex, pageSize, "", filterExpressionField.value);
    }
    Sys.Application.add_load(loadData);
    function DataBindGrid(currentPageIndex, pageSize, sortExpressionsAsSQL, filterExpressionsAsSQL) {
        var requiredMetaFields = ['Title', 'Publication_Date'];
        var cultureInfoField = document.getElementById('<%= cultureInfoField.ClientID %>');
        Telerik.Cms.Engine.Services.ContentService.GetContentItems(currentPageIndex * pageSize, pageSize,
        sortExpressionsAsSQL, filterExpressionsAsSQL, requiredMetaFields, cultureInfoField.value, dataProviderName, updateGrid, OnFailed);
    }
     
       ....
          ...



    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    23 Nov 2009
    Link to this post
    Ivan,

    Thank you for your quick response last week.  I have gotten it to the point that the override column is being added to the grid (I want Event Start Date to be added).  The problem is that every row shows "undefined", even though there should be a valid event start date that should show. 

    I'm guessing I'm missing something obvious.  Code snippets are below and screen caps attached.  I added "EventStart" to the EventsItemsList.ascx.resx file.

    <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>
            <telerik:ClientTemplate Name="EventStart" runat="server">
                {#MetaFields.EventStart#}
            </telerik:ClientTemplate>

            <telerik:ClientTemplate Name="Status" runat="server">
                {#Status#}
            </telerik:ClientTemplate>
        </telerik:ClientTemplatesHolder>

    <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:GridTemplateColumn
                        UniqueName="View"  
                        SortExpression="Title"
                        ItemStyle-CssClass="gridContentTitle"
                        HeaderText="<%$ Resources:Title %>">
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn
                        UniqueName="EventStart"
                        HeaderText="<%$ Resources:EventStart %>">
                    </telerik:GridTemplateColumn>

                    <telerik:GridTemplateColumn
                        UniqueName="Status"  
                        HeaderText="<%$ Resources:Status %>">
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>

    function DataBindGrid(currentPageIndex, pageSize, sortExpressionsAsSQL, filterExpressionsAsSQL) {
        var requiredMetaFields = ['Title','Event_Start'];  //this is Event_Start because that is the KeyValue in the GVMetaData table
        var cultureInfoField = document.getElementById('<%= cultureInfoField.ClientID %>');
        Telerik.Cms.Engine.Services.ContentService.GetContentItems(currentPageIndex * pageSize, pageSize,
        sortExpressionsAsSQL, filterExpressionsAsSQL, requiredMetaFields, cultureInfoField.value, dataProviderName, updateGrid, OnFailed);
    }


    Many thanks for your help,

    Chad
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Nov 2009
    Link to this post
    Hello Chad,

    The problem appears if you have added globalization attribute in your web.config and some specific culture.  Try using the template below:

    Also the metakey is not EventStart. It has underscore separator - Event_Start.

    <%@ Control Language="C#" %>
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery"></telerik:JsFileLink>
     
    <div style="display:none;">
        <asp:TextBox ID="FilterExpressionField" runat="server"></asp:TextBox>
    </div>
    <div class="ToolsAll">
        <asp:HyperLink ID="createNewButton" runat="server" cssClass="CmsButLeft new">
            <strong class="CmsButRight light">
                <asp:Literal ID="createNewButtonText" runat="server" />
            </strong>
        </asp:HyperLink>
        <div class="groupEdit">
            <asp:LinkButton ID="groupOperationsLink" runat="server" CssClass="groupEditExpand" OnClientClick="groupOpsVisible = ToggleDiv('groupOperationsDiv'); return false;">
                <asp:Literal ID="litButton1" runat="server" Text="<%$Resources:GroupOperations %>"></asp:Literal>
            </asp:LinkButton>
            <div id="groupOperationsDiv" style="display: none; ">
                <div class="groupActionsPopup">
                    <span class="numberOfSelectedItem"><strong id="numberOfSelectedItems">0</strong><asp:Literal ID="lblSelectedItems" runat="server" Text="<%$Resources:ItemsSelected %>"></asp:Literal></span>
                    <ul>
                        <li>
                            <span id="disabledDeleteGroupGrid" class="disabled"><asp:Literal ID="Literal20" runat="server" Text="<%$Resources:Delete %>"></asp:Literal></span>
                            <asp:LinkButton Style="display: none;" ID="btnDeleteGroupGrid" runat="server" OnClientClick="DeleteWithConfirmation(); return false;" Text="<%$Resources:Delete %>"></asp:LinkButton>
                            <asp:Literal ID="lblSelected" runat="server" Text="<%$Resources:Selected %>" />
                        </li>
                    </ul>
                </div>
            </div>
        </div>
         
        <asp:PlaceHolder ID="fullWindow" runat="server">
        <div class="searchItems">
            <div class="searchInputs">
                <asp:Label ID="Label1" AssociatedControlID="searchField" Text="<%$Resources:SearchEventsBy %>" runat="server"></asp:Label>
                <asp:DropDownList ID="searchField" runat="server"></asp:DropDownList>
                <asp:Label ID="Label2" AssociatedControlID="searchWords" Text="<%$Resources:For %>" runat="server"></asp:Label>
                <asp:TextBox ID="searchWords" CssClass="searchString" runat="server"></asp:TextBox>
                <asp:Button ID="searchButton" Text="<%$Resources:Search %>" runat="server" CssClass="searchButton"/>
            </div>
        </div>
        </asp:PlaceHolder>
        <div class="clear"><!-- --></div>
     
    </div>
    <div class="workArea multipleItemView">
        <telerik:MessageControl runat="server" ID="message">
        <ItemTemplate>
            <asp:Label runat="server" ID="messageText"></asp:Label>
        </ItemTemplate>
        </telerik:MessageControl>
            <div class="listHeader moduleItemsHeader">
                <h2 class="gridTitle"><asp:Label runat="server" ID="title"><asp:Literal ID="Literal2" runat="server" Text="<%$Resources:AllEvents %>" /></asp:Label></h2>
            </div>
            <div class="viewOptions">
                <p>View as: <asp:HyperLink ID="listViewCommand" runat="server" Text="<%$Resources:ListView %>" CssClass="sfSel"></asp:HyperLink> | <asp:HyperLink ID="schedulerViewCommand" runat="server" Text="<%$Resources:SchedulerView %>"></asp:HyperLink></p>
                  
            </div>
        <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>
               <telerik:ClientTemplate Name="Event_Start" runat="server">
                {#MetaFields.Event_Start#}
            </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>
                     <telerik:GridTemplateColumn
                        UniqueName="Event_Start"
                        HeaderText="Event_Start">
                    </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>
        </div>
        <asp:HiddenField ID="cultureInfoField" runat="server" />
         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
    <!--
    var dataProviderName = "<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).ProviderName %>";
    var gridTemplates = ClientTemplates.GetSet("<%= GridTemplates.ClientID %>");
    var allowDelete = "<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).AllowDelete %>";
    var allowModify = "<%= ((Telerik.Events.WebControls.Admin.EventsItemsList)Parent.Parent).AllowModify %>";
    var groupOpsVisible = false;
     
    function loadData() {
        var tableView = $find('<%= ItemsGrid.ClientID %>').get_masterTableView();
        var currentPageIndex = tableView.get_currentPageIndex();
        var pageSize = tableView.get_pageSize();
        var filterExpressionField = document.getElementById('<%= FilterExpressionField.ClientID %>');
        DataBindGrid(currentPageIndex, pageSize, "", filterExpressionField.value);
    }
    Sys.Application.add_load(loadData);
    function DataBindGrid(currentPageIndex, pageSize, sortExpressionsAsSQL, filterExpressionsAsSQL) {
        var requiredMetaFields = ['Title', 'Event_Start'];
        var cultureInfoField = document.getElementById('<%= cultureInfoField.ClientID %>');
        Telerik.Cms.Engine.Services.ContentService.GetContentItems(currentPageIndex * pageSize, pageSize,
        sortExpressionsAsSQL, filterExpressionsAsSQL, requiredMetaFields, cultureInfoField.value, dataProviderName, updateGrid, OnFailed);
    }
    function RadGrid_Command(sender, args) {
        args.set_cancel(true);
        var currentPageIndex = sender.get_masterTableView().get_currentPageIndex();
        var pageSize = sender.get_masterTableView().get_pageSize();
        var sortExpressions = sender.get_masterTableView().get_sortExpressions();
        var filterExpressions = sender.get_masterTableView().get_filterExpressions();
        if (sortExpressions.length > 0 && filterExpressions.length > 0 && currentPageIndex > 0) {
            sender.get_masterTableView().set_currentPageIndex(0);
        }
        var filterExpressionField = document.getElementById('<%= FilterExpressionField.ClientID %>');
        var sortExpressionsAsSQL = sortExpressions.toString();
        var filterExpressionsAsSQL = filterExpressions.toString();
        if(filterExpressionsAsSQL.length == 0)
            filterExpressionsAsSQL = filterExpressionField.value;
        DataBindGrid(currentPageIndex, pageSize, sortExpressionsAsSQL, filterExpressionsAsSQL);
    }
    function updateGrid(result) {
        var tableView = $find("<%= ItemsGrid.ClientID %>").get_masterTableView();
        tableView.set_virtualItemCount(result.Count);
        tableView.set_dataSource(result.Data);
        tableView.dataBind();
         
        var emptyWindow = document.getElementById('empty');
        var gridPlaceholder = document.getElementById('gridPlaceholder');
        if(result.Count > 0)
        {
            emptyWindow.style.display = 'none';
            gridPlaceholder.style.display = '';
        }
        else
        {
            emptyWindow.style.display = '';
            gridPlaceholder.style.display = 'none';
        }
    }
    function RadGrid_RowSelected(sender, args) {
     
        var dataItem = args.get_gridDataItem();
        var insertNewID = true;
        var currentCount = parseInt(document.getElementById("numberOfSelectedItems").innerHTML);
        if (dataItem._dataItem != null) {
            for (var i = 0; i < selectedContentIDs.length; i++) {
                if (selectedContentIDs[i] == dataItem._dataItem.ID) {
                    insertNewID = false;
                }
            }
            if (insertNewID) {
                selectedContentIDs[selectedContentIDs.length] = dataItem._dataItem.ID;
                currentCount++;
            }
        }
        document.getElementById("numberOfSelectedItems").innerHTML = currentCount.toString();
        EnableOrDisableGroupOperationButtons(currentCount != 0);
    }
    function RadGrid_RowDeselected(sender, args) {
        var dataItem = args.get_gridDataItem();
        var currentCount = parseInt(document.getElementById("numberOfSelectedItems").innerHTML);
        if (dataItem._dataItem != null) {
            for (var i = 0; i < selectedContentIDs.length; i++) {
                if (selectedContentIDs[i] == dataItem._dataItem.ID) {
                    delete selectedContentIDs[i];
                    currentCount--;
                }
            }
        }
        document.getElementById("numberOfSelectedItems").innerHTML = currentCount.toString();
        EnableOrDisableGroupOperationButtons(currentCount != 0);
    }
     
    function RadGrid_RowDataBound(sender, args) {
        var dataItem = args.get_dataItem();
        var item = args.get_item();
        var columns = item.get_owner().get_columns();
        var cells = args.get_item().get_element().cells;
         
        if(dataItem['IsLocked'] == true) {
            args.get_item().get_element().className = "cms_locked";
        }
        else {
            args.get_item().get_element().className = "";
        }
     
        for (var i = 0; i < cells.length; i++) {
            var cell = cells[i];
            var elementName = columns[i].get_element().UniqueName;
            var html = gridTemplates.Replace(elementName, dataItem);
            if (html != null)
                if (html != "") {
                var date = null;
     
                if (elementName == 'Event_Start') {
                    date = new Date(dataItem['MetaFields'].Event_Start);
                }
                else if (elementName == 'Event_End') {
                date = new Date(dataItem['MetaFields'].Event_End);
                }
     
                if (date && !isNaN(date)) {
                    html = date._toFormattedString('dd MMM yyyy, hh:mm tt', Sys.CultureInfo.CurrentCulture);
                }
     
                cell.innerHTML = html;
            }
            else {
                cell.innerHTML = " ";
            }
        }
         
        // disable delete if needed
        if(dataItem['IsDisabled'] == true || (allowDelete.toLowerCase() == 'false' && dataItem['IsOwner'] == false)) {
            $(args.get_item().get_element()).children(".delete").children("a").removeAttr("href");
            $(args.get_item().get_element()).children(".deleteDis").children("a").removeAttr("href");
            $(args.get_item().get_element()).children(".delete").addClass("deleteDis");
            $(args.get_item().get_element()).children(".delete").removeClass("delete");
        }
        else {
            $(args.get_item().get_element()).children(".deleteDis").addClass("delete");
            $(args.get_item().get_element()).children(".deleteDis").removeClass("deleteDis");
        }
         
        // disabled edit if needed
        if (dataItem['IsDisabled'] == true || (allowModify.toLowerCase() == 'false' && dataItem['IsOwner'] == false)) {
            $(args.get_item().get_element()).children(".edit").children("a").removeAttr("href");
            $(args.get_item().get_element()).children(".editDis").children("a").removeAttr("href");
            $(args.get_item().get_element()).children(".edit").addClass("editDis");
            $(args.get_item().get_element()).children(".edit").removeClass("edit");
        }
        else {
            $(args.get_item().get_element()).children(".editDis").addClass("edit");
            $(args.get_item().get_element()).children(".editDis").removeClass("editDis");
        }
    }
     
    function OnFailed(error) {
        alert("Stack Trace: " + error.get_stackTrace() + "/r/n" +
            "Error: " + error.get_message() + "/r/n" +
            "Status Code: " + error.get_statusCode() + "/r/n" +
            "Exception Type: " + error.get_exceptionType() + "/r/n" +
            "Timed Out: " + error.get_timedOut());
    }
    function DeleteContent(contentId) {
            Telerik.Cms.Engine.Services.ContentService.DeleteContent(contentId, dataProviderName, DeleteContent_Success, OnFailed);
    }
    function DeleteContent_Success(result) {
        var tableView = $find('<%= ItemsGrid.ClientID %>').get_masterTableView();
        var currentPageIndex = tableView.get_currentPageIndex();
        var pageSize = tableView.get_pageSize();
        var sortExpression = tableView.get_sortExpressions();
        var filterExpressionField = document.getElementById('<%= FilterExpressionField.ClientID %>');
        var sortExpressionAsSQL = sortExpression.toString();
        var filterExpressionAsSQL = filterExpressionField.value.toString();
        tableView.clearSelectedItems();
        DataBindGrid(currentPageIndex, pageSize, sortExpressionAsSQL, filterExpressionAsSQL);
    }
     
    var selectedContentIDs = [];
     
    function DeleteSelectedContent() {
        var guidsToPass = [];
        for (var i = 0; i < selectedContentIDs.length; i++) {
            if (selectedContentIDs[i] != undefined) {
                guidsToPass[guidsToPass.length] = selectedContentIDs[i];
            }
        }
        Telerik.Cms.Engine.Services.ContentService.GroupDeleteContent(guidsToPass, dataProviderName, DeleteContent_Success, OnFailed);
        ToggleDiv('groupOperationsDiv');
    }
     
    function DeleteWithConfirmation() {
        if (confirm('<%= GetLocalResourceObject("AreYouSure") %>')) DeleteSelectedContent();
    }
     
    function EnableOrDisableGroupOperationButtons(enable) {
        if (enable) {
            $("#<%= btnDeleteGroupGrid.ClientID %>").show();
            $("#disabledDeleteGroupGrid").hide();
        }
        else {
            $("#<%= btnDeleteGroupGrid.ClientID %>").hide();
            $("#disabledDeleteGroupGrid").show();
        }
    }
     
    function ToggleDiv(divID) {
        var div = document.getElementById(divID);
        var result = div.style.display == "block";
        if (div.style.display != "none") {
            div.style.display = "none";
        }
        else {
            div.style.display = "block";
        }
        return result;
    }
     
    document.onclick = check;
    function check(e) {
        var target = (e && e.target) || (event && event.srcElement);
        var obj = document.getElementById('groupOperationsDiv');
        var obj2 = document.getElementById('<%= groupOperationsLink.ClientID %>');
        if (groupOpsVisible) {
            checkParent(target) ? obj.style.display = 'none' : null;
        }
        else {
            checkParent(target) ? obj.style.display = 'none' : null;
            if (target == obj2) {
                obj.style.display = 'block';
            }
        }
    }
    function checkParent(t) {
        while (t.parentNode) {
            if (t == document.getElementById('groupOperationsDiv')) {
                return false;
            }
            t = t.parentNode;
        }
        return true;
    }
     
    -->
            </script>
        </telerik:RadCodeBlock>
        <asp:PlaceHolder ID="emptyWindow" runat="server">
            <div id="empty">
                <h2 class="gridTitle"><asp:Literal ID="Literal3" runat="server" Text="<%$Resources:NoEvents %>" /></h2>
                <p><asp:HyperLink ID="createNewEmpty" runat="server" cssClass="mainLink" ToolTip="<%$Resources:CreateYourFirstEventTooltip %>"><strong><asp:Literal ID="Literal4" runat="server" Text="<%$Resources:CreateYourFirstEvent %>" /></strong></asp:HyperLink><br />
                <asp:Literal ID="Literal5" runat="server" Text="<%$Resources:Or %>" />, <a href="http://www.sitefinity.com/sf3/faq.html#gc" target="_blank" title="Opens in new browser window"><asp:Literal ID="Literal6" runat="server" Text="<%$Resources:CheckEventsFAQ %>" /></a></p>      
            </div>
        </asp:PlaceHolder>
    </div>

    The changes to the template are highlighted.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    24 Nov 2009
    Link to this post
    This works magnificently Ivan - thank you. 

    Thanks!
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Nov 2009
    Link to this post
    Hello Chad,

    This could be result of the globalization attribute added in your project web.config file or server config file
    If this is the case you can try creating a Web.config file in Services folder. located in Sitefinity/Admin Then add en-US culture in globalization in this web.config file:

    <?xml version="1.0"?>
    <configuration>
      <appSettings/>
      <connectionStrings/>
      <system.web>
        <globalization uiCulture="en" culture="en-US"/>
      </system.web>
    </configura


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    24 Nov 2009
    Link to this post
    Ivan,

    You don't by chance have any other ideas on this, do you?  I tried the web.config solution you suggested, but the dates are still coming back in GMT, 6 hours ahead of my time zone.  They are only doing this on the Events Items page.  When I actually go to edit an event, the time shows as expected.

    I tried some manual manipulation of the time directly in the RadGrid_RowDataBound method, but to no avail so far.  I was trying to run with this:

    if (elementName == 'Event_Start') {
                    date = new Date(dataItem['MetaFields'].Event_Start);
                }
                else if (elementName == 'Event_End') {
                    date = new Date(dataItem['MetaFields'].Event_End);
                }

                if (date && !isNaN(date)) {
                   
                    var dateConvert = new Date();
                    dateConvert = date.localeFormat(Sys.CultureInfo.CurrentCulture.dateTimeFormat.FullDateTimePattern));
                   
                    html = dateConvert;
                }

    I tried the web.config globalization value in both the Admin/Services directory, and in the normal root-level web.config.

    Thank you again.

    Chad
  8. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    24 Nov 2009
    Link to this post
    Hi Chad,

    Can you try with the following in the template for listing event items:
    if (date && !isNaN(date)) {
    html = date._toFormattedString('dd MMM yyyy, hh:mm tt', Sys.CultureInfo.CurrentCulture);
    }

    This issue will be resolved in our next service pack - due by the end of the month.
     
    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    24 Nov 2009
    Link to this post
    Hi Radoslav,

    The code that you supplied was what Ivan originally supplied for me to try, and unfortunately it's not working.  I have that in place, along with the web.config globalization value Ivan suggested.  Do you have any other ideas?

    Thank you.

    This is in place, but the time still isn't being converted to the local time zone:
    if (date && !isNaN(date)) {
    html = date._toFormattedString('dd MMM yyyy, hh:mm tt', Sys.CultureInfo.CurrentCulture);
    }

  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Nov 2009
    Link to this post
    Hello Chad,

    Check the Event_Start and Event_End values in [sf_GCMetaData] table of your database where the actual value should be written. I fit differs from what you see there is some settings in the project or server that changes the current culture and the data time seems to be converted.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    24 Nov 2009
    Link to this post
    And what if the values I see for Event_Start and Event_End values in [sf_GCMetaData] are what I see on the Events Listing page?  That is, the date/time stored in sf_GCMetaData appears to be the GMT.  Yet, when it gets pulled into the Event EDIT page, it displays the appropriate local time (GMT-6).  However, it doesn't display the GMT-6 time on the Events Listing page.

    Thank you,
    Chad
  12. Chad
    Chad avatar
    19 posts
    Registered:
    11 Sep 2008
    24 Nov 2009
    Link to this post
    Ivan,

    I was able to figure out a way to manipulate the date within the RadGrid_RowDataBound using javascript, so the date/time is now displaying like I want it to.

    Thank you very much for your assistance through this.  You and your team are very helpful!

    Chad
Register for webinar
12 posts, 0 answered