View Single Post
  #8 (permalink)  
Old June 15th, 2009, 01:05 PM
philip_cole philip_cole is offline
Friend of Wrox
Points: 894, Level: 11
Points: 894, Level: 11 Points: 894, Level: 11 Points: 894, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: London, , United Kingdom.
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Indeed, depending on how it is bound. But remember ItemCreated is also raised before Page_Load on each request, so update events etc can be raised, at which point it will not be binding.
It works in this case because DataBinder.Eval returns null, and so if(prodtype=="Sample") returns false.

If you change it to something like this, you will get an exception:
Code:
if (prodtype == "Sample" || prodtype == null)
{
    view["ProductText"] = "Sample product";
}