Interesting Type difference in .NET 4.0 when using DataBinding

Posted by Lorin Thwaits on Geeks with Blogs See other posts from Geeks with Blogs or by Lorin Thwaits
Published on Mon, 22 Mar 2010 00:39:00 GMT Indexed on 2010/03/22 0:51 UTC
Read the original article Hit count: 438

Filed under:

Consider this common construct that you and I have thrown into ASPX pages for years now:

<%# DataBinder.Eval (Container.DataItem, "EmployeeID") %>

In .NET 3.5.1 and older it returns -- tada -- a string.  No mystery there.  But in .NET 4.0 it returns the same type as the underlying data type -- which in this case for me was a nullable int.  Interesting, no?

© Geeks with Blogs or respective owner