Creating a Compound Page that displays an EntryGroup and List using the Web Class

Less than one minute read time.

Below is some example code that shows how to create a compound page that displays an EntryGroup and List using the Web Class.


using Sage.CRM.Controls;
using Sage.CRM.Data;
using Sage.CRM.UI;
using Sage.CRM.Utils;
using Sage.CRM.WebObject;
 
namespace SA_Basic_1
{
    class ViewCompanyANDOppos : Web
    {
        public override void BuildContents()
        {
            GetTabs();
            AddContent(HTML.Form());
 
            VerticalPanel myContainer = new VerticalPanel();
            
            EntryGroup myCompanyBoxShort = new EntryGroup("CompanyBoxShort");
            Record myCompany = FindCurrentRecord("company");
            myCompanyBoxShort.GetHtmlInViewMode(myCompany);
 
            List listCompanyOppos = new List("opportunitylist");
            listCompanyOppos.Title = Metadata.GetTranslation("tabnames", "opportunity");
            listCompanyOppos.Filter = "oppo_primarycompanyid = " + GetContextInfo("company", "comp_companyid");
            
            myContainer.Add(myCompanyBoxShort);
            myContainer.Add(listCompanyOppos);
 
            AddContent(myContainer);
        }
    }
}

Notes:

The Notification is displayed because of the standard behaviour of the GetTabs() method.

The page is arranged using a VerticalPanel class.

Parents
  • I am working on creating a similar page. I think I have most of it worked out. However, I have an extra panel on the screen and don't know why. I used the Entity Template available in the developers kit and modified the DataPage to accommodate an additional panel. What I have appears to work as intended. However, I have an additional blank panel at the bottom of the screen and I am not sure why. This is the code I am using. The panel at the bottom displays the layout for the CompanyBoxLong...however, there is no data in it. I don't want the empty panel on the screen....however, I don't know where in my code it is rendering it and I don't know how to make it go away. Any assistance would be greatly appreciated....Thanks!

    using System;

    using System.Collections.Generic;

    using System.Text;

    using Sage.CRM.WebObject;

    using Sage.CRM.Controls;

    using Sage.CRM.Data;

    using Sage.CRM.Utils;

    using Sage.CRM.UI;

    namespace CHSresident.DataPages

    {

    public class CompanyDataPage : DataPage

    {

    public CompanyDataPage()

    : base("Company", "comp_companyid", "CompanyBoxLong")

    {

    }

    public override void BuildContents()

    {

    try

    {

    /* Add your code here */

    //GetTabs();

    //Setup Panel and attributes

    VerticalPanel vp = new VerticalPanel();

    vp.AddAttribute("width", "100%");

    //================Pane1 #1 ===========================================================

    //Retrieve Record

    Record compRecord = FindCurrentRecord("Company");

    //Get the Screen

    EntryGroup compScreen = new EntryGroup("CompanyBoxLong");

    //Add a title to the panel

    compScreen.Title = "Account Detail";

    //Fill the screen with the Company record identified above in Retrieve Record

    compScreen.Fill(compRecord);

    //display the screen

    vp.Add(compScreen);

    //===============Panel #2 ============================================================

    //Retrieve List

    List leaseGrid = new List("LeaseList");

    //Select records to display (i.e. query the records)

    leaseGrid.SelectSql = "Select * From Lease";

    //Add a title to the panel

    leaseGrid.Title = "Lease Data";

    //Create the relationship between the records (the company record and the lease record)

    leaseGrid.Filter = "Lease_companyid = " + compRecord.GetFieldAsString("comp_companyid");

    //Set number of rows to view per screen

    leaseGrid.RowsPerScreen = 5;

    //Add the list to the screen

    vp.Add(leaseGrid);

    AddContent(vp);

    //...etc

    //Dispatch.

    base.BuildContents();

    }

    catch (Exception error)

    {

    this.AddError(error.Message);

    }

    }

    }

    }

Comment
  • I am working on creating a similar page. I think I have most of it worked out. However, I have an extra panel on the screen and don't know why. I used the Entity Template available in the developers kit and modified the DataPage to accommodate an additional panel. What I have appears to work as intended. However, I have an additional blank panel at the bottom of the screen and I am not sure why. This is the code I am using. The panel at the bottom displays the layout for the CompanyBoxLong...however, there is no data in it. I don't want the empty panel on the screen....however, I don't know where in my code it is rendering it and I don't know how to make it go away. Any assistance would be greatly appreciated....Thanks!

    using System;

    using System.Collections.Generic;

    using System.Text;

    using Sage.CRM.WebObject;

    using Sage.CRM.Controls;

    using Sage.CRM.Data;

    using Sage.CRM.Utils;

    using Sage.CRM.UI;

    namespace CHSresident.DataPages

    {

    public class CompanyDataPage : DataPage

    {

    public CompanyDataPage()

    : base("Company", "comp_companyid", "CompanyBoxLong")

    {

    }

    public override void BuildContents()

    {

    try

    {

    /* Add your code here */

    //GetTabs();

    //Setup Panel and attributes

    VerticalPanel vp = new VerticalPanel();

    vp.AddAttribute("width", "100%");

    //================Pane1 #1 ===========================================================

    //Retrieve Record

    Record compRecord = FindCurrentRecord("Company");

    //Get the Screen

    EntryGroup compScreen = new EntryGroup("CompanyBoxLong");

    //Add a title to the panel

    compScreen.Title = "Account Detail";

    //Fill the screen with the Company record identified above in Retrieve Record

    compScreen.Fill(compRecord);

    //display the screen

    vp.Add(compScreen);

    //===============Panel #2 ============================================================

    //Retrieve List

    List leaseGrid = new List("LeaseList");

    //Select records to display (i.e. query the records)

    leaseGrid.SelectSql = "Select * From Lease";

    //Add a title to the panel

    leaseGrid.Title = "Lease Data";

    //Create the relationship between the records (the company record and the lease record)

    leaseGrid.Filter = "Lease_companyid = " + compRecord.GetFieldAsString("comp_companyid");

    //Set number of rows to view per screen

    leaseGrid.RowsPerScreen = 5;

    //Add the list to the screen

    vp.Add(leaseGrid);

    AddContent(vp);

    //...etc

    //Dispatch.

    base.BuildContents();

    }

    catch (Exception error)

    {

    this.AddError(error.Message);

    }

    }

    }

    }

Children
No Data