challenging dynamic reporting portal using webparts.

R

rifat yavuz

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
 
C

Coskun SUNALI [MVP]

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
 
R

rifat yavuz

Thanks for the idea,
I will try the idea

tsk :)

Coskun SUNALI said:
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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,056
Messages
2,570,443
Members
47,089
Latest member
Bobby2025b

Latest Threads

Top