
todays puzzler may be hard to read in the screen shot above (click on image to expand) but basically the debugger is complaining that I'm trying to cast the value "0" to an integer value and it can't handle that. (fwiw, most people accept zero as a valid integer)... bizarre!
if ((int)Args.NewValues["ItemPrice"] < 0)
{
Args.Cancel = true;
EditMSG.Text = "-- Item price is out of range";
}
can anyone tell me why the if statement bombs when Args.NewValues["ItemPrice"] == "0"? I should think that would cast nicely to an int as I am attempting. (BTW Args is type DetailsViewUpdateEventArgs)
UPDATE:
here's a workaround --
if (Convert.ToInt32(Args.NewValues["ItemPrice"]) < 0)...
this way you're not casting, you're converting. ok!
