The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Kackwiesel (5) [Avatar] Offline
#1
1st question:
page 118, code section (protected override void CreateChildControls() {...}) - isn't there missing the "base.CreateChildControls" line?

2nd question:
is the order importend in which the "base.CreateChildControls" line comes? whats the differenz of this two code samples:

a)
protected override void CreateChildControls()
{
.... //something else
base.CreateChildControls
}

b)
protected override void CreateChildControls()
{
base.CreateChildControls
.... //something else
}

thx & greetings! (btw.: great book!! smilie)
wictor.wilen (29) [Avatar] Offline
#2
Re: two small things
Hi and thanks for the comments

1st answer:
about the base.CreateChildControls(). You do not have to use base.CreateChildControls() when deriving directly from the WebPart class (ASP.NET or SharePoint). The base implementation does not do anything. It's purely there for overriding. On the other hand if you are overriding other Web Parts that might have a CCC that contains controls or other stuff then you might need to override.

2nd answer:
Depends on what WebPart you are overrideing. Do you need the controls from the WP you are overriding then have it first.

/WW
Kackwiesel (5) [Avatar] Offline
#3
Re: two small things
Thx for ur fast response and answers! A last question focusing the "Creating connectable Web Parts" paper: is it possible to code one webpart that can connect to a second of it's sort? i wrote a small demo but it did't work - so i'm not sure if its not possible or i've only made some mistakes...

btw. on page 73 you wrote: "3.8 Extensibility in Visual Studio 2010
Visual Studio 2010 has been designed and built so that I can be extended in various ways to improve your productivity and interactivity. You might experience situations when you need to customize the [...]" - i think you ment "[..] that it can be [..]", don't u?
wictor.wilen (29) [Avatar] Offline
#4
Re: two small things
Hi again,
yes you can have a Web Part being both consumer and provider as long as it is two instances of it on the same page.
Thanks for spotting the spelling error - it is fixed!
/WW