Regarding Sample Code

Published 13 December 05 10:44 AM | despos

For "obvious" time constraints, the source code of Programming ASP.NET 2.0--Core Reference couldn't be tested under RTM. On the other hand, the book shipped Nov 2th at the same as the RTM, but a book normally takes 6 weeks from final PDF review to printers. Sure, online source code is a slightly different story, but ...

However, as a matter of fact, if you download the source code of the book and run under RTM it fails with tons of errors and warnings. As you should know, the more messages you get from VS, the less severe the problem is. There are basically two things to fix:

1) Implement ICallbackEventHandler differently to take into account the new member GetCallbackResult

You just add a private string variable and store there the value that now is being returned by RaiseCallbackEvent. Next, you return that string from GetCallbackResult.

2) In the web.config, the <protectedData> section has been renamed (and reworked, but that's not an issue for the source code). Just remove it from web.config

Due to a bug in VS 2005, you should also remove the xmlns attribute from <configuration>.

I do have updated code that I'll post today or tomorrow but still don't know where :) I'll post soon about it. In a matter of days (?) updated code should be anyway online through the MS Press Web site.

Sorry about that ...

Comments

# Wallym said on December 13, 2005 12:11 PM:

Yep, you are not the only person with that problem.

# Alistair Cook said on December 14, 2005 06:25 PM:

Great book.

For the GridView Delete Record javascript confirmation functionality in Chapter 11 (p483), when the link button is changed to a command button the javascript doesn't work due to the way the GridView control implements the postback javascript code.

Here's a variation of the code that does work:

protected void dtvDetails_ItemCreated(object sender, EventArgs e)
{
// Test FooterRow to make sure all rows have been created
if (dtvDetails.FooterRow != null)
{
// The command bar is the last element in the Rows collection
int commandRowIndex = dtvDetails.Rows.Count - 1;
DetailsViewRow commandRow = dtvDetails.Rows[commandRowIndex];

// Look for the Delete button
DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0];
foreach (Control ctl in cell.Controls)
{
Button btn = ctl as Button;
if (btn != null)
{
if (btn.CommandName == "Delete")
{
btn.ToolTip = "Click here to delete the current record";
btn.OnClientClick += "if (!confirm('Do you really want to delete this record?')){return false};";
}
}
}
}
}

Hopefully this will save someone else some time. :-)

# Jscript error said on December 29, 2005 01:53 PM:

Hi Dino,
I was trying out the sample code in your article http://msdn.microsoft.com/msdnmag/issues/05/01/CuttingEdge/default.aspx
for client callbacks in custom control.
I modified it to run under asp.net 2.0 release version.
Strangely, after the client side javascript CallbackValidator_UpdateUI gets called, i am getting this script error -

Microsoft Jscript runtime error: '_pending Callbacks[...].async' is null or not an object

Debugging both the RaiseCallbackEvent on server and client side javascript CallbackValidator_UpdateUI function went fine though.

Regards,
Gulzar

Leave a Comment

(required) 
(required) 
(optional)
(required)