|
Subject:
|
Errata - Chapter 10, Page 377, C#
|
|
Posted By:
|
RobC
|
Post Date:
|
8/31/2006 9:14:55 AM
|
In step 8:
private void Page_PreRender(object sender, System.EventArgs e) ...is probably wrong. I say "probably" because I can't get this example to work (I'll leave that for another topic).
But based on the the files in the End\Chapter10\ folder, it looks like this should be:
protected void SqlDataSource1_PreRender(object sender, System.EventArgs e)
In addition, it looks like there's a missing step in the book. You apparently also have to duplicate step 8, but specify the Repeater control:
protected void Repeater1_PreRender(object sender, System.EventArgs e)
|
|
Reply By:
|
RobC
|
Reply Date:
|
8/31/2006 10:22:24 AM
|
After doing more testing, it looks like both the End\Chapter10\NewsUserControls\ files and the steps in the book are wrong. Step 8 in the book is correct, but there's something missing in the previous steps. I've gotten the entire example to work, but I've lost track of the changes because it required a bunch of experiments with copying, pasting and re-typing between the Begin and End files.
Maybe the Wrox guys can sort this out...
|
|
Reply By:
|
rieks
|
Reply Date:
|
9/26/2006 4:20:45 AM
|
Same thing happens to me. VWD says the problem is with the 'void' part. Has anyone found a way to make it work?
|
|
Reply By:
|
DanM
|
Reply Date:
|
9/29/2006 5:40:48 AM
|
Hi there RobC, rieks,
There isn't a problem with step 8 per se. Having run through the example myself using the download for Chapter 10, it looks like the problem is that web.config has the wrong connection string in it. Here's my suggestion.
- Take a fresh copy of the chapter10 download and open the begin\chapter10\newsusercontrol project.
- Skip point 2 as the .ascx file has already been created.
- Step 6 implies that the connection string in web.config should be called WroxUnited but the one in the download isn't. Open up web.config and replace the contents of the <connectionStrings> element with the following.
<connectionStrings> <add name="WroxUnited" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|WroxUnited.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings>
- Follow the rest of the steps as in the book. You can use either the default.aspx already in the project or create newsdisplay.aspx for step 9.
I hope that helps. There's no need to create Repeater1_PreRender.
Dan Maharry Read the feed at http://feeds.feedburner.com/dansarchive
|
|
Reply By:
|
RobC
|
Reply Date:
|
9/29/2006 8:38:37 AM
|
Hi Dan,
quote: There isn't a problem with step 8 per se.
Right, I originally thought step 8 was incorrect because it didn't match up with the code in \End\Chapter10\NewsUserControl\.
However, it turned out that the End code is incorrect: changing the value of the ItemsToShow property of the NewsUserControl doesn't work. I did eventually get it work with the \Begin\ files.
|
|
Reply By:
|
DanM
|
Reply Date:
|
10/3/2006 2:26:31 AM
|
Rob,
I'm hoping to get a new set of downloads and errata for chapters 7 and 8 done as soon as possible. Sorry it took a while to reply
Dan
Dan Maharry Read the feed at http://feeds.feedburner.com/dansarchive
|