[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

challenging dynamic reporting portal using webparts.

rifat yavuz

7/4/2008 2:53:00 PM

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


2 Answers

Coskun SUNALI [MVP]

7/9/2008 11:34:00 AM

0

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://...
http://www.pr...

"rifat yavuz" <rifatyavuz@gmail.com> wrote in message
news:uknjzWe3IHA.5088@TK2MSFTNGP03.phx.gbl...
> 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

7/10/2008 8:05:00 AM

0

Thanks for the idea,
I will try the idea

tsk :)

"Coskun SUNALI [MVP]" <Coskun@SUNALI.com> wrote in message
news:u1gr8eb4IHA.4908@TK2MSFTNGP04.phx.gbl...
> 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://...
> http://www.pr...
>
> "rifat yavuz" <rifatyavuz@gmail.com> wrote in message
> news:uknjzWe3IHA.5088@TK2MSFTNGP03.phx.gbl...
>> 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
>>
>>