Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 11th, 2011, 12:25 PM
Authorized User
Points: 222, Level: 4
Points: 222, Level: 4 Points: 222, Level: 4 Points: 222, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2007
Location: Phoenix, AZ, USA.
Posts: 48
Thanks: 4
Thanked 0 Times in 0 Posts
Default Problem with BookInfo object in Chapter 9

Hey,

I'm working the example in Chapter 9, but when I try to add the subobjects, the author property is not in the intellisense list. Also I get an error when I try to use the description property, something about it being a type but is being used as property.

Here is my code:

<code>
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace BookInfoCS
{
[
ParseChildren(false)]
[
ToolboxData("<{0}:BookInfo runat=server></{0}:BookInfo>")]
publicclassBookInfo : WebControl
{
privatestring _MainTitle;
privatestring _SubTitle;
privateArrayList _Authors = newArrayList();
privateArrayList _ChildControls;
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[
NotifyParentProperty(true)]
[
PersistenceMode(PersistenceMode.InnerProperty)]
publicstring MainTitle
{
get { return _MainTitle; }
set { _MainTitle = value; }
}
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[
NotifyParentProperty(true)]
[
PersistenceMode(PersistenceMode.InnerProperty)]
publicstring SubTitle
{
get { return _SubTitle; }
set { _SubTitle = value; }
}
//[PersistenceMode(PersistenceMode.InnerProperty)]
publicArrayList Authors
{
get { return _Authors; }
set { _Authors = value; }
}
privatestring _Description;
publicstring Description
{
get { return _Description; }
set { _Description = value; }
}
publicArrayList ChildControls
{
get { return _ChildControls; }
set { _ChildControls = value; }
}
protectedoverridevoid AddParsedSubObject(object obj)
{
if (obj isAuthor)
{
if (_Authors == null)
{
_Authors =
newArrayList(2);
}
this.Authors.Add(obj);
}
if (obj isTitles)
{
this.MainTitle = ((Titles)obj).Main;
this.SubTitle = ((Titles)obj).SubTitle;
}
if (obj isLiteralControl)
{
Description ds;
ds = (
Description)obj;
this.Description = ds.Text;
}
if (obj isLabel)
this.Controls.Add((WebControl)obj);
}
protectedoverridevoid Render(HtmlTextWriter writer)
{
//base.Render(writer);
writer.Write("<Table>");
foreach (Author aut inthis.Authors)
{
writer.Write(
"<tr>");
writer.Write(
"<tc>" + aut.FirstName + "</tc");
writer.Write(
"<tc>" + aut.LastName + "</tc>");
writer.Write(
"</tr>");
}
writer.Write(
"</Table>");
}
}
publicclassAuthor
{
privatestring _FirstName;
privatestring _LastName;
publicstring FirstName
{
get { return _FirstName; }
set { _FirstName = value; }
}
publicstring LastName
{
get { return _LastName; }
set { _LastName = value; }
}
public Author()
{
//
// TODO: Add constructor logic here
//
}
}
publicclassTitles
{
privatestring _MainTitle;
privatestring _SubTitle;
publicstring Main
{
get { return _MainTitle; }
set { _MainTitle = value; }
}
publicstring SubTitle
{
get { return _SubTitle; }
set { _SubTitle = value; }
}
}
publicclassDescription : LiteralControl
{
}

Any help ...!

Tom
}
</code>
__________________
Thomas G Magaro
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 13: context object problem dany96 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 July 9th, 2011 07:30 AM
Chapter 14: Object not set ksnortum BOOK: Beginning ASP.NET 4 : in C# and VB 11 January 5th, 2011 04:13 PM
Chapter 9 Object not Queryable ja11946 BOOK: Professional ASP.NET 4 : in C# and VB 1 December 5th, 2010 02:20 PM
chapter about object datasource and gridview? asptwodev BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 November 2nd, 2007 12:53 PM



All times are GMT -4. The time now is 07:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.