Double display of vertical panel in a .net ListPage

Help!

I have a list page that I am creating that will operate like a "QuickLook" page. One of the panels that I put on the page was Resident Deposits. For some reason, this panel is displaying twice and I am not sure why. Hoping someone can help and perhaps see what I have done in the code to cause this. This is what I have in my list page...

namespace CHSresident.DataPages

{

public class CompanyDataPage : DataPage

{

public CompanyDataPage()

//Remove the screen name here to avoid having a blank screen display

// Original : base("Company", "comp_companyid", "CompanyGeneralScreen")

: base("Company", "comp_companyid")

{

this.EditButton = false;

this.ContinueButton = false;

}

public override void BuildContents()

{

try

{

//Setup Panel and attributes

VerticalPanel vp = new VerticalPanel();

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

//Retrieve Record

Record compRecord = FindCurrentRecord("Company");

//==================Panel (Security/Credit Deposit Info--List)=================================

//Retrieve List

List DepositGrid = new List("ResidentDepositsList");

//Add a title to the panel

DepositGrid.Title = "Resident Deposits";

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

DepositGrid.Filter = "comp_companyid = " + compRecord.GetFieldAsString("comp_companyid");

//Set number of rows to view per screen

DepositGrid.RowsPerScreen = 1;

//Add the list to the screen

vp.Add(DepositGrid);

AddContent(vp);

Is it because of my filter? My list is created from a view. That view contains the field comp_companyid. Therefore, I am using that field to create the relationship to my company table that also contains comp_companyid.

Any assistance would be greatly appreciated. Thanks!

  • 0

    What does the code for the other list look like? I don't see anything immediately that would make that list display twice.

  • 0

    Thank you for the response. Here is the code for the other panel...

    //===============Panel (Current Lease Record--List)=========================================

    //Retrieve List

    List leaseGrid = new List("LeaseList");

    //Add a title to the panel

    leaseGrid.Title = "Current Lease Record";

    //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 = 1;

    //Add the list to the screen

    vp.Add(leaseGrid);

    AddContent(vp);

    I was able to get the double panel to disappear by going back to the first panel, I commenting out the last line....AddContent(vp);.

    No matter how I switch the panels around, I have to comment out AddContent(vp) from the first panel in the code or the first panel appears twice. If I comment it out in the second panel, I loose the entire second panel.

    I don't understand why I have to comment out that line in the first panel because I don't see in the code where I previously added the content. I only know that it seems to work.

    If you see why it makes sense, please let me know. Thanks!

  • 0

    is it not because you've added the first list to the 'vp' Panel, added that panel the screen, then added the second list to the same panel and added it to the screen a second time?

    Instead just call AddContent(vp); once, after the second list.

  • 0

    Not sure, can you indicate to me where in my code I added the first screen a second time as I don't see it.

    Thank you for your assistance.

  • 0

    Andy:

    I did not see the line in your post that said, instead just call AddContent(vp); once, after the second list.

    I think I understand what you are saying, when I put in AddContent(vp) the first time, it added the content for panel #1, when I added it the second time (after the second list), it added the content for panel #1 and panel #2, therefore, duplicating panel #1 twice. If I remove the AddContent(vp) line from the first panel of code and leave it in the second panel, the code will add the content from panel #1 and panel #2. This is what I ultimately did and it worked...however, I did not really understand why.

    I see what you are saying now. Thank you for the clarification.