Hi there,
You probably don't get "No data returned", but due to an error the page is not updated and still shows the old "no data" message. Just for fun, try this:
1. Restore the + again in the code
2. Remove the <UpdatePanel> and <ContentTemplate> or turn on JavaScript debugging through Tools | Internet Options | Advanced in IE.
3. Rerun the page. Now you get an error like this:
Line: 5
Error: Sys.WebForms.PageRequestManagerServerErrorExceptio n: Conversion from string "PictureDetails.aspx?Id=" to type 'Double' is not valid.
Alternatively you may get:
[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.Conve rsions.ParseDouble(String Value, NumberFormatInfo NumberFormat) +211
Microsoft.VisualBasic.CompilerServices.Conve rsions.ToDouble(String Value, NumberFormatInfo NumberFormat) +74
So, the conversion failed right away. Due to the Ajax UpdatePanel, you probably never got the error in the browser.
The Tio in Chapter 14, page 507 works because the Id is converted to a String:
NavigateUrl='<%# "ViewDetails.aspx?ReviewId=" + Eval("Id").ToString() %>'
In this example, both ends of the assignment operations are strings, so concatenation works as expected. In the problem you posted, the code tries to "add up" the string and the Id which obviously fails.
There are two ways to fix it:
1. Use &. This tells the
VB compiler to concatenate the values rather than try to add them to each other.
2. Use ToString() on Eval("Id"). This removes the ambiguity between the two sides of the assignment, so again the compiler knows it should concatenate, rather than add the two values to each other.
Thanks for catching and reporting this; I'll file an errata for it.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
Beginning ASP.NET 3.5 : in C# and VB,
ASP.NET 2.0 Instant Results and
Dreamweaver MX 2004
Want to be my colleague? Then check out this post.