CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.web_parts_and_personalization Tags:
Item Type: NewsGroup Date Entered: 9/20/2007 7:32:28 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 8 Views: 24 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
9 Items, 1 Pages 1 |< << Go >> >|
Andrey1
Asp.Net User
CatalogZone design view9/20/2007 7:32:28 PM

0/0

I've developed a custom catalog zone class, which I declare on my web page like this:

<drp:ReportCatalogZone ID="wpczCatalog" runat="server" BackColor="#FFFBD6" BorderColor="#CCCCCC" BorderWidth="1px" Font-Names="Verdana" Padding="6">

[... some content here ...]

</drp:ReportCatalogZone>

Now when I'm trying to open my page in design view, I'm getting this error message written inside of the control:

Error rendering control - wpczCatalog
An unhandled exception has occured.
Object reference is not set to an instance of an object.

Can anyone please help with that?

Andrey.

Rob82
Asp.Net User
Re: WebPartZone design view9/21/2007 10:05:00 AM

0/0

You're probably forgetting to initialize some child control of the custom webpartzone. Could you post some of the code of your custom webpartzone? (isn't it a catalogzone by the way as the name seems to indicate?) There doesn't seem to be an error in the code snippet you posted.

Andrey1
Asp.Net User
Re: CatalogZone design view9/21/2007 12:35:25 PM

0/0

Rob82:

You're probably forgetting to initialize some child control of the custom webpartzone. Could you post some of the code of your custom webpartzone? (isn't it a catalogzone by the way as the name seems to indicate?) There doesn't seem to be an error in the code snippet you posted.

You're right! It is CatalogZone rather than WebPartZone. Sorry about that.

Here's the source code:

public class ReportCatalogZone : CatalogZone

{

private ArrayList _malCatalogParts = new ArrayList();

public ReportCatalogZone() {}

public void AddReportCatalogPart(ReportCatalogPart prcpPart) {

_malCatalogParts.Add(prcpPart);

}

protected override CatalogPartCollection CreateCatalogParts() {

return new CatalogPartCollection(base.CreateCatalogParts(), _malCatalogParts);

}

}

And here is declarative part (complete):

<drp:ReportCatalogZone ID="wpczCatalog" runat="server" BackColor="#FFFBD6" BorderColor="#CCCCCC" BorderWidth="1px" Font-Names="Verdana" Padding="6">

<HeaderVerbStyle Font-Bold="False" Font-Size="0.8em" Font-Underline="False" ForeColor="#333333" />
<PartTitleStyle BackColor="#990000" Font-Bold="True" Font-Size="0.8em" ForeColor="White" />
<PartChromeStyle BorderColor="#FFCC66" BorderStyle="Solid" BorderWidth="1px" />
<InstructionTextStyle Font-Size="0.8em" ForeColor="#333333" />
<PartLinkStyle Font-Size="0.8em" />
<EmptyZoneTextStyle Font-Size="0.8em" ForeColor="#333333" />
<LabelStyle Font-Size="0.8em" ForeColor="#333333" />
<VerbStyle Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" />

<ZoneTemplate>

<asp:PageCatalogPart ID="wpcPageCatalog" runat="server" />
<drp:ReportCatalogPart runat="server" ID="ReportCatalogPart1" ReportConfigurationFile="~/ReportConfig.xml" SQLConfigurationFile="~/SQLConfig.xml" Title="Registered Reports" />

</ZoneTemplate>

<PartStyle BorderColor="#FFFBD6" BorderWidth="5px" />
<SelectedPartLinkStyle Font-Size="0.8em" />
<FooterStyle BackColor="#FFCC66" HorizontalAlign="Right" />
<HeaderStyle BackColor="#FFCC66" Font-Bold="True" Font-Size="0.8em" ForeColor="#333333" />
<EditUIStyle Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" />

</drp:ReportCatalogZone>

Thanks,

Andrey.

Rob82
Asp.Net User
Re: CatalogZone design view9/21/2007 12:51:49 PM

0/0

I see that you've got a  method called AddReportCatalogPart, but it seems like it is never used. This means that your _malCatalogParts collection will just be empty and that probably causes return new CatalogPartCollection(base.CreateCatalogParts(), _malCatalogParts) to throw an error. I think that since you already declaratively added a ReportCatalogPart there is no need to override CreateCatalogParts(). Try removing that method from your custom catalogzone and it should run just fine.

Andrey1
Asp.Net User
Re: CatalogZone design view9/21/2007 1:04:52 PM

0/0

I removed everything from the ReportCatalogZone class, now it looks like this:

public class ReportCatalogZone : CatalogZone

{

public ReportCatalogZone() {}

}

And still there's this error in the designer. Everything work just fine at the run-time.

Andrey.

Andrey1
Asp.Net User
Re: CatalogZone design view9/21/2007 1:13:55 PM

0/0

I just decided to remove <drp:ReportCatalogZone>, and revert back to <asp:CatalogZone>. Everything worked, but still there's an error in the designer. I think it's related to the CatalogPart object rather than CatalogZone object.

Should I post the code for the class derived from CatalogPart? There's slightly more code in it...

Thanks,

Andrey.

Rob82
Asp.Net User
Re: CatalogZone design view9/21/2007 1:22:59 PM

0/0

Go ahead, it might indeed be some control that you try to render in the reportCatalogPart without initializing. 

Andrey1
Asp.Net User
Re: CatalogZone design view9/21/2007 1:44:22 PM

0/0

Ok, this is the code for ReportCatalogPart class:

public class ReportCatalogPart : CatalogPart
    {

        private ReportConfigurationReader _mrptReader;
        private SQLConfigurationReader _msqlReader;

        private string _mstrReportConfigurationFile;
        private string _mstrSQLConfigurationFile;

        public ReportCatalogPart()
        {
            if (ViewState["ReportConfigurationFile"] != null) _mstrReportConfigurationFile = (string)ViewState["ReportConfigurationFile"];
            if (ViewState["SQLConfigurationFile"] != null) _mstrSQLConfigurationFile = (string)ViewState["SQLConfigurationFile"];
            CreateConfiguration();
        }

        [
        UrlProperty(),
        DefaultValue(""),
        Editor(typeof(System.Web.UI.Design.XmlUrlEditor), typeof(System.Drawing.Design.UITypeEditor)),
        ]
        public string ReportConfigurationFile
        {
            get
            {
                return _mstrReportConfigurationFile;
            }
            set
            {
                _mstrReportConfigurationFile = value;
                ViewState["ReportConfigurationFile"] = value;
            }
        }

        [
        UrlProperty(),
        DefaultValue(""),
        Editor(typeof(System.Web.UI.Design.XmlUrlEditor), typeof(System.Drawing.Design.UITypeEditor)),
        ]
        public string SQLConfigurationFile
        {
            get
            {
                return _mstrSQLConfigurationFile;
            }
            set
            {
                _mstrSQLConfigurationFile = value;
                ViewState["SQLConfigurationFile"] = value;
            }
        }

        public override WebPartDescriptionCollection GetAvailableWebPartDescriptions()
        {
            CreateConfiguration();
            if (_mrptReader != null)
            {
                return ReportLoader.GetReportDescriptions(_mrptReader);
            }
            return null;
        }

        public override WebPart GetWebPart(WebPartDescription description)
        {
            CreateConfiguration();
            if (_msqlReader != null)
            {
                return ReportLoader.GetReportWebPart(this.Page, _mrptReader, _msqlReader, description.ID);
            }
            return null;
        }

        private void CreateConfiguration()
        {
            if (_mrptReader == null && _mstrReportConfigurationFile != "" && _mstrReportConfigurationFile != null) _mrptReader = new ReportConfigurationReader(this.Context.Server.MapPath(_mstrReportConfigurationFile));
            if (_msqlReader == null && _mstrSQLConfigurationFile != "" && _mstrSQLConfigurationFile != null) _msqlReader = new SQLConfigurationReader(this.Context.Server.MapPath(_mstrSQLConfigurationFile));
        }
    }

 Thanks,

Andrey.

Andrey1
Asp.Net User
Re: CatalogZone design view9/21/2007 3:55:28 PM

0/0

Ok, I got it working... It looks like two configuration editors were referred, and no instance of those were created... I changed two methods:

public override WebPartDescriptionCollection GetAvailableWebPartDescriptions()
        {
            if (!DesignMode)
            {
                CreateConfiguration();
                if (_mrptReader != null)
                {
                    return ReportLoader.GetReportDescriptions(_mrptReader);
                }
            }
            return new WebPartDescriptionCollection();
        }

        public override WebPart GetWebPart(WebPartDescription description)
        {
            if (!DesignMode)
            {
                CreateConfiguration();
                if (_msqlReader != null)
                {
                    return ReportLoader.GetReportWebPart(this.Page, _mrptReader, _msqlReader, description.ID);
                }
            }
            return null;
        }

And now it's working.

Thanks anyway for your help!

Andrey.

9 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET 2.0 All-In-One Desk Reference For Dummies: all-in-one desk reference for dummies Authors: Doug Lowe, Jeff Cogswell, Ken Cox, Pages: 910, Published: 2006
Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
ASP.NET 2.0 Black Book: black book Authors: Dreamtech Software, Dreamtech Software, Charul Shukla, Anil Kumar Barnwal, Dreamtech Software India, Pages: 1167, Published: 2006
Microsoft SharePoint: Building Office 2003 Solutions Authors: Scot P. Hillier, Pages: 392, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Professional Visual Studio 2005 Authors: Andrew Parsons, Nick Randolph, Pages: 869, Published: 2006
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Mastering Web Development with Microsoft Visual Studio 2005 Authors: John Paul Mueller, Pages: 822, Published: 2005
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006

Web:
Rahul Soni's blog : Dynamically adding webparts to the dynamically ... Today we are going to discuss how to add webparts to a Catalog Zone ... If you switch to the design view of default.aspx you will see that there are two ...
CatalogZone Members (System.Web.UI.WebControls.WebParts) ClearChildState, Deletes the view-state and control-state information for all the server ... Gets design-time data for a control. (Inherited from Control.) ...
What's New in Beta 2: Web Parts Revisited | O'Reilly Media Switch to Design view and drag a CatalogZone control into newly empty cell. Click on the zone, and in the properties window set the HeaderText property to ...
Dynamically Adding Custom User Controls to a Web Part Catalog Zone ... There are four different modes in which you can view the page, they are Browse, Edit, Catalog, and Design. We shall learn about these modes of display, ...
Catalogzone and trying to add images - ASP.NET Forums When I add the image button and declare what the image is it shows up in my design mode. When I view it in a browser it just has a box with an x in it. ...
CatalogZone Methods (System.Web.UI.WebControls.WebParts) Gets design-time data for a control. (Inherited from Control.) ... that should persist across postbacks even when view state is disabled on the control. ...
WebPart Framework basics Aug 17, 2007 ... Go to design view of your webpage. Drag and drop CatalogZone control in thrid cell (blue) . Now drag and drop DeclarativeCatalogPart. ...
CodeProject: Display a DropDownList in a CatalogZone. Free source ... Oct 12, 2005 ... Design and Architecture ยท Installation .... I want to display catalog zone contents in Gird view Any suggestions?? Question ...
Customising the CatalogZone class It is available under Tools, Options, View tab but not directly from a . ... ( microsoft.public.word.newusers); Re: ComboBox DropDown Size: Design vs Run ...
What Are Web Parts? | O'Reilly Media Delete the Web Part Zone from the column and drag in a Catalog Zone. Switch to Design view and click on your new Catalog Zone and then click the smart tag ...




Search This Site:










question! signinbtn - hitting enter/return

where to get template to create menu?

nasty error message when online - not on pc

3.0.11 breaks after i build the solution

newbie- 3.1

users and applications

how do i change my main menu?

default button + loginview + login problem

new pa deployment question

page.controls don't exist in page from masterpage

create user wizard control

global.asax and master page question

dnn and sharepoint - coexist peacefully ?

there were errors during copy web. please view log for details

problem on deploying large website

iframe link question

storing data to the database

forms authentication problem

blank screen

beginning a new website in visual web developer 2005 express edition, asp.config security interface will not accept any type password

dynamic "page last updated" date

vs.net problems (open project dnn)

some master page things showing only on default.aspx

lost and tired!!

getting dotnetnuke to work on firefox

module container display error

interfacing between dnn2 and (remote) legacy asp code

iseditable and editurl errors

build your community image gallery with wt-imagegallery pro

dnn 2.12 installation problems on win2k pro for development

 
All Times Are GMT