UniGrid with different data source

Zhivko Petkov asked on March 17, 2022 09:07

Hello people,

I'm trying to create a unigrid with external datasource(generated from the code) in custom module, but I'm getting the following error:

[AbstractUserControl.ShowMessage]: Page is not 'CMSPage' or missing messages placeholder.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestGrid_1.aspx.cs" Inherits="CMSApp.Portal.CustomModules.TestGrid_1" %>

<%@ Register Src="~/CMSAdminControls/UI/UniGrid/UniGrid.ascx" TagName="UniGrid" TagPrefix="cms" %>
<%@ Register Namespace="CMS.UIControls.UniGridConfig" TagPrefix="ug" Assembly="CMS.UIControls" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div class="cms-bootstrap">
            <asp:ScriptManager ID="manScript" runat="server" ScriptMode="Release" EnableViewState="false" />
            <asp:Label runat="server" ID="lblInfo" EnableViewState="false" Visible="false" />
            <cms:UniGrid ID="CustomGrid" runat="server">
                <GridColumns>
                    <ug:Column Source="Name" Caption="Name" Width="100%" />
                </GridColumns>
            </cms:UniGrid>
        </div>
    </form>
</body>

And the code behind:

  CssRegistration.RegisterBootstrap(Page);
  ScriptHelper.RegisterBootstrapScripts(Page);

  var dS = new List<Person>();
  dS.Add(new Person() { Name = "TestName", Age = 19 });
  dS.Add(new Person() { Name = "TestName", Age = 25 });

  CustomGrid.DataSource = dS;
  CustomGrid.DataBind();

Is it possible to use UniGrid with such a datasource?

Thanks in advance.

Recent Answers


Brenden Kehren answered on March 17, 2022 14:15

It looks like you're creating an aspx page and you're not inheriting a master page class that has all the necessary CMS code in it. Check out the documentation for developing ASPX pages in Kentico.

Otherwise you might want to look at creating a web part and placing it on a regular page in the content tree.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.