challenging dynamic reporting portal using webparts.

Discussion in 'ASP .Net Building Controls' started by rifat yavuz, Jul 4, 2008.

  1. rifat yavuz

    rifat yavuz Guest

    hello,
    I am trying to create n controls, modify each controls' properties then add
    them to the catalog zone.

    Then the user will select and add each webpart to the approciate
    webpartzone.

    why n?
    each control is a different report the user has generated before and each
    query of them is saved in the database.
    the purpose of this is, when the user logs in, I will find the querries of
    the user, populate each report item (control) in the catalog zone,
    then the user will be able to select what report she wants to see in her
    welcome page....

    need a lot help on this (referral, sample, advice.....)

    rifat
     
    rifat yavuz, Jul 4, 2008
    #1
    1. Advertisements

  2. Hi Rifat,

    DeclarativeCatalogZone has a property called "WebPartsTemplate" which has
    the type of ITemplate.

    So; the idea how to use it is just like below.



    <asp:CatalogZone ID="mainCatalogZone" runat="Server">
    <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="mainCatalogPart" runat="server"
    Title="Available WebParts">
    </asp:DeclarativeCatalogPart>
    </ZoneTemplate>
    </asp:CatalogZone>



    In code behind:



    DeclarativeCatalogPart m_MainCatalogPart =
    mainCatalogZone.FindControl("mainCatalogPart") as DeclarativeCatalogPart;

    if (m_MainCatalogPart == null)
    return;

    WebPartsList m_WebPartsList = new WebPartsList();

    m_MainCatalogPart.WebPartsTemplate = m_WebPartsList;



    And "WebPartsList" class and its logic looks like the following:



    public class WebPartsList : ITemplate
    {
    #region ITemplate Members

    public void InstantiateIn(Control owner)
    {
    // Add WebParts here, in a foreach or a for or any other applicable circle

    WebPart m_WebPart = new WebPart(); // You must set the correct type here

    m_WebPart.ID = "wp123";
    m_WebPart.Title = "Title";
    m_WebPart.Description = "Description";

    owner.Controls.Add(m_WebPart);
    }

    #endregion
    }

    --
    All the best,
    Coskun SUNALI
    MVP ASP/ASP.NET
    http://sunali.com
    http://www.propeople.dk
     
    Coskun SUNALI [MVP], Jul 9, 2008
    #2
    1. Advertisements

  3. rifat yavuz

    rifat yavuz Guest

    Thanks for the idea,
    I will try the idea

    tsk :)

     
    rifat yavuz, Jul 10, 2008
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.