Hi Joe,
Just some suggestions for databinding:
in the <%# %expression, you can use helper function, for example:
Property='<%# MyFunction(Eval("propertyname")) %>'
this function can be defined in aspx inline or in code behind. Such
function can let you do some complex formating or customization on the raw
databound value.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Joe" <jb*******@noemail.noemail>
References: <#4**************@TK2MSFTNGP03.phx.gbl>
Subject: Re: Eval returning a null when an int is expected
Date: Fri, 7 Dec 2007 17:55:52 -0500
Never mind
"Joe" <jb*******@noemail.noemailwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I'm binding to a column in a TemplateField. In some cases the join I
have
>returns a null for an int field. I would like to specify a default value
somehow so I don't end up with a null exception.
I'm binding the CurrentRating of the Rating control so I'm doing
Convert.ToInt32(Eval('MyField')). This of course throws an exception if
the value being returned is null.
Is there another means of binging to that property where either a null
doesn't matter or I can replace it with a 0?
Thanks,
Joe