Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2006, 08:03 PM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to .MAttButler
Default Chapter 12

Chapter 12 is almost done, I'll be posting it shortly.

 
Old September 7th, 2006, 08:25 PM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to .MAttButler
Default

I've posted Chapter 12 at http://100days.net/wrox/

The customization and communication from that chapter aren't implemented yet. That's next. I'll update the code with it as soon as it's done.

 
Old September 9th, 2006, 05:47 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm trying to walk through chapter 12 and I'm on page 392 where it tells me to compile to see my control in my toolbox like figure 12.5.

I've built the project, there is a reference to it in test web project, but I still don't see it in the toolbox.

My code is below.

Is there something missing from the code?
Thanks in advance for any help!
czone

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CaseStudyControlsCS
{
    [ToolboxData("<{0}:CustomerInformation runat=server></{0}:CustomerInformation>")]
    public class CustomerInformation : System.Web.UI.WebControls.WebParts.WebPart
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (this.DesignMode == true)
            {
                this.EnsureChildControls();
            }
        }

        protected override void CreateChildControls()
        {

            System.Web.UI.WebControls.Style st = new System.Web.UI.WebControls.Style();

            if (this.ControlStyleCreated == true)
            {
                st = this.ControlStyle;
            }
            else
            {
                st = new System.Web.UI.WebControls.Style();
            }

            System.Web.UI.WebControls.Label lblName = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblEmail = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblStreet = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblCity = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblStateProvince = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblCountry = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblNameLb = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblEmailLb = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblStreetLb = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblCityLb = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblStateProvinceLb = new System.Web.UI.WebControls.Label();
            System.Web.UI.WebControls.Label lblCountryLb = new System.Web.UI.WebControls.Label();

            lblName.ID = "lblName";
            lblName.Attributes["DisplayType"] = "label";

            lblEmail.ID = "lblEmail";
            lblEmail.Attributes["DisplayType"] = "label";

            lblStreet.ID = "lblStreet";
            lblStreet.Attributes["DisplayType"] = "label";

            lblCity.ID = "lblCity";
            lblCity.Attributes["DisplayType"] = "label";

            lblStateProvince.ID = "lblStateProv";
            lblStateProvince.Attributes["DisplayType"] = "label";

            lblCountry.ID = "lblCountry";
            lblCountry.Attributes["DisplayType"] = "label";


            lblNameLb.Text = "Name:";
            lblNameLb.Attributes["DisplayType"] = "data";

            lblEmailLb.Text = "Email:";
            lblEmailLb.Attributes["DisplayType"] = "data";

            lblStreetLb.Text = "Street:";
            lblStreetLb.Attributes["DisplayType"] = "data";

            lblCityLb.Text = "City:";
            lblCityLb.Attributes["DisplayType"] = "data";

            lblStateProvinceLb.Text = "State/Province:";
            lblStateProvinceLb.Attributes["DisplayType"] = "data";

            lblCountryLb.Text = "Country:";
            lblCountryLb.Attributes["DisplayType"] = "data";

            this.Controls.Clear();
            this.Controls.Add(lblName);
            this.Controls.Add(lblNameLb);
            this.Controls.Add(lblEmail);
            this.Controls.Add(lblEmailLb);
            this.Controls.Add(lblStreet);
            this.Controls.Add(lblStreetLb);
            this.Controls.Add(lblCity);
            this.Controls.Add(lblCityLb);
            this.Controls.Add(lblStateProvince);
            this.Controls.Add(lblStateProvinceLb);
            this.Controls.Add(lblCountry);
            this.Controls.Add(lblCountryLb);

            this.ChildControlsCreated = true;

        }

    }
}


czone
 
Old September 10th, 2006, 05:20 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forget my previous post, I was able to resolve the issue by manually selecting the DLL when adding an item to the tool box.

Thanks!

czone
 
Old September 10th, 2006, 05:25 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do have a question related to page 421 - Displaying User Data on Postback.

The text is not clear as to where the code should go. I put it in the IPostBackDataHandler.LoadPostData method (see page 413) but I get errors telling me that the txtName & others are not recognized.

So where should the code on page 421 go? Is it a new method or should it be added to an existing method? If an existing method, which one?

I also get an error telling me that the public modifier is not balid for the IPostBackDataHandler.LoadPostData method. This is fixed by not putting a modifier on it but I don't think this is the best way to fix the error. How should this error be fixed?

Thanks,
Czone

czone
 
Old September 10th, 2006, 08:31 PM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to .MAttButler
Default

Have you had a chance to download the newer version of Chapter 12's code, yet? Get it from here and take a look at it. Let's work from that codebase to get to your answers. The text leaves out a few crucial details but you'll see where those methods should be in the newer code. Let me know what your questions are after you look through it.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM
Chapter 12 Koga VB.NET 2002/2003 Basics 0 November 2nd, 2004 11:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.